Skip to content

[Bug] Line graph with Y axis "category" renders null values incorrectly #16664

@htr3n

Description

@htr3n

Version

5.3.1

Link to Minimal Reproduction

https://codesandbox.io/s/echarts-category-83rl4d?file=/src/index.js

Steps to Reproduce

  1. Create a simple line chart with the following options
import * as echarts from "echarts";

const chart = echarts.init(document.getElementById("chart"));

const options = {
  animation: false,
  xAxis: {
    type: "category",
    splitLine: { show: true },
    data: ["1:00", "2:00", "3:00", "4:00", "5:00"]
  },
  yAxis: {
    type: "category",
    axisLabel: {
      show: true
    },
    showMinLabel: true,
    showMaxLabel: true,
    data: ["A", "B", "C"]
  },
  series: [
    {
      type: "line",
      data: ["null", "A", undefined, "C", null],
      symbol: "circle",
      showSymbol: true,
      symbolSize: 8,
      lineStyle: {
        opacity: 0
      },
      connectNulls: false
    }
  ]
};
chart.setOption(options);

Current Behavior

The chart is rendered correctly with respect to valid values (e.g. the values that are defined in the Y axis data parameter) and "null" (note that null in double quotes as a string) but incorrectly regarding the native JavaScript null value. For instance, in the included example, the last three values are JavaScript native null has been rendered as legit ones with the dots at the value A.

Expected Behavior

The chart should not render any dots regarding the input data null (without double quotes).

Surprisingly, ECharts renders correctly the value "null" (null inside double quotes as a legit JS string, not the native null value).

Another note, ECharts renders correctly if the input data is the native JS undefined value.

Environment

- OS: N/A
- Browser: N/A
- Framework: N/A

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions