Skip to content

[Bug] Chart crash when both "xAxis.axisLabel.customValues" and "xAxis.axisLabel.formatter" are set #21441

Closed

Description

@byv55f5f5

Version

6.0.0

Link to Minimal Reproduction

https://echarts.apache.org/examples/zh/editor.html?c=line-simple&code=5VbdatswFL7fUwh64RZCsPwvjw5KR68KG2RsF2UXjqM6YrYVbKVrNvruO7Ily7aSbIOymylgy8fnOzq_X8x3gvEaXaOfbxDaZCJrqUjRAzygTiRXy_dNTrVUrgdHsIo6C-RICNYbz_m6MDo4jiIfY8-Va4EwDn136ZsVgCwJYxuSBBriEhxZkCgei3zfMuCFkTEQenMDxA0siO8lg5tuiK0zk9CC9E5KSL0vy_5qK8U6_DNKYaADPqMUYR3UOaVEh3FGKe4NnVdK_KFubhIFy3CB4iCOLD1I5qAXkkhqeXZFiBsbawQvo9GSEB_bEKy9xG4AXdA54NrdQrA_VC72I8t0SCbdcgRvmiWO4RaC8IgWMWFiMj8FEj8WHfHSM-kMAq-LBrxZ2m1FvPB0ddTmRd66fdGwTaoGVfBdiqJeo6SPMMZu_9CwYmue1lwIXqnHzpLgvBQMwMoO6Be0SZGTPbPW6VFy-5GzWsgXmhhKVtOVOJTADVqEUM5LLsEXWZyRda7w6ih16y7PN2BTI6vsOUV9AiJCZLJ7dXHYgXVFN4Mn93Dwn7qRe_J31I3e2CeWfxsZo3UhtkMif2d90625dTBcsqL-wsT2PlvTMoWk7ql-l-9bqMDnrNxTiN-w6pwwZ2Q4o7YJbU1tGGqakdCMbqbEMrVhqGRGGnN6mLDAkT5VFevToDP4yGuxYj8gp3gADTn17uRvyGmVNQWrU0S0YMs29MMTbcoMeva_TKxMYFNlopvGyycZ8BW6foe63VLwFcxwXVxezUfuMB45NVod5uRstVv-PUWPWdmqLJ8cnFOa7a5k4lUH9hV6SU23MlpJkeHDljbMNNAQHwNqABodN5xKoYxnOELmYXWo1hxcHGUDoTqrJgErsPqCmhMIrXO-megDQY55UK7DKby6_QvfrUr9pe_HK901uqrig3ORuCH8LcrvzItbP4ER6bZ3dzc3w_Y2CN7L78-Xt78A&enc=deflate

Steps to Reproduce

option = {
  dataset: [
    {
      source: [
        ['time', 'data1', 'data2'],
        [1766311200000, 11530.333333333334, 1857],
        [1766318400000, 10916.333333333334, 1867.3333333333333],
        [1766325600000, 10952.333333333334, 1904],
        [1766332800000, 11051.333333333334, 1885],
        [1766340000000, null, null],
        [1766347200000, null, null],
        [1766354400000, null, null],
        [1766361600000, null, null],
        [1766368800000, null, null],
        [1766376000000, null, null],
        [1766383200000, 10864.5, 7476],
        [1766390400000, 10596, 7423],
        [1766390700000, 10891.666666666666, 7431],
        [1766391000000, 10416.5, 7407],
        [1766391300000, 11736.666666666666, 7459.333333333333],
        [1766391600000, 10770, 5663],
        [1766391900000, 10519.666666666666, 7368.666666666667],
        [1766392200000, 10442.5, 7333.5],
        [1766392500000, null, null],
      ],
    },
  ],
  grid: {
    top: 6,
    left: 0,
    right: 0,
    bottom: 0,
  },
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      lineStyle: {
        color: '#a7a9bc',
      },
    },
  },
  xAxis: {
    max: 1766396999000,
    type: 'time',
    axisLine: {
      lineStyle: {
        color: '#c2c2c2',
      },
    },
    axisTick: {
      length: 6,
      lineStyle: {
        color: '#dddddd',
      },
      alignWithLabel: true,
      customValues: [
        1766311200000, 1766318400000, 1766325600000, 1766332800000,
        1766340000000, 1766347200000, 1766354400000, 1766361600000,
        1766368800000, 1766376000000, 1766383200000, 1766390400000,
      ],
    },
    axisLabel: {
      fontSize: 10,
      color: '#2F2F2F',
      margin: 9,
      hideOverlap: true,
      customValues: [
        1766311200000, 1766318400000, 1766325600000, 1766332800000,
        1766340000000, 1766347200000, 1766354400000, 1766361600000,
        1766368800000, 1766376000000, 1766383200000, 1766390400000,
      ],
      formatter: (value) => value.toString(),
    },
  },
  yAxis: {
    type: 'value',
    axisLine: {
      show: false,
    },
    axisTick: {
      show: false,
    },
    splitLine: {
      lineStyle: {
        color: '#c2c2c2',
      },
    },
    axisLabel: {
      fontSize: 10,
      color: '#2F2F2F',
      margin: 6,
    },
    min: 0,
  },
  series: [
    {
      silent: true,
      type: 'line',
      showSymbol: false,
      name: {
        type: 'data1',
      },
      encode: {
        x: 'time',
        y: 'data1',
      },
    },
    {
      silent: true,
      type: 'line',
      showSymbol: false,
      name: {
        type: 'data2',
      },
      encode: {
        x: 'time',
        y: 'data2',
      },
    },
  ],
  color: ['#805500', '#C38200', '#FFAA00', '#FFC44D'],
};

Current Behavior

The devtools show errors: VM361 about:srcdoc:1 failed to run code TypeError: Cannot read properties of undefined (reading 'level')

The chart works well if I remove either xAxis.axisLabel.customValues or xAxis.axisLabel.formatter.

Expected Behavior

The chart works.

Environment

- OS: macOS Sequoia
- Browser: Microsoft Edge 143.0.3650.80 (arm64)
- Framework: Vue@3

Any additional comments?

No response

Activity

  1. added
    en
    pending
    on Dec 22, 2025
  2. plainheart commented on Dec 22, 2025

    @plainheart
    Member

    This should have been fixed in #21352.

  3. removed
    pending
    on Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugen

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions