VisActor/VChart

[Bug] unit disappear when set width of axis

Open

#3,923 opened on Apr 24, 2025

View on GitHub
 (0 comments) (0 reactions) (1 assignee)TypeScript (212 forks)user submission
VMindbuggood first issue

Repository metrics

Stars
 (1,800 stars)
PR merge metrics
 (Avg merge 3d 12h) (15 merged PRs in 30d)

Description

Version

1.13.9

Link to Minimal Reproduction

Steps to Reproduce

{
  "type": "common",
  "padding": {
    "right": 0,
    "left": 0
  },
  "data": [
    {
      "id": "id0",
      "values": [
        {
          "x": "周一",
          "type": "午餐",
          "y": 25
        },
        {
          "x": "周二",
          "type": "午餐",
          "y": 30
        },
        {
          "x": "周三",
          "type": "午餐",
          "y": 24
        },
        {
          "x": "周四",
          "type": "午餐",
          "y": 25
        },
        {
          "x": "周五",
          "type": "午餐",
          "y": 20
        },
        {
          "x": "周六",
          "type": "午餐",
          "y": 22
        },
        {
          "x": "周日",
          "type": "午餐",
          "y": 19
        }
      ]
    },
    {
      "id": "id1",
      "values": [
        {
          "x": "周一",
          "type": "饮料",
          "y": 100000
        },
        {
          "x": "周二",
          "type": "饮料",
          "y": 2
        },
        {
          "x": "周三",
          "type": "饮料",
          "y": 3
        },
        {
          "x": "周四",
          "type": "饮料",
          "y": 4
        },
        {
          "x": "周五",
          "type": "饮料",
          "y": 5
        },
        {
          "x": "周六",
          "type": "饮料",
          "y": 6
        },
        {
          "x": "周日",
          "type": "饮料",
          "y": 7
        }
      ]
    }
  ],
  "series": [
    {
      "type": "bar",
      "id": "bar",
      "dataIndex": 0,
      "label": {
        "visible": false
      },
      "seriesField": "type",
      "xField": [
        "x",
        "type"
      ],
      "yField": "y",
      "bar": {
        "style": {
          "fill": "#FFCC00"
        }
      }
    },
    {
      "type": "line",
      "id": "line",
      "dataIndex": 1,
      "label": {
        "visible": false
      },
      "seriesField": "type",
      "xField": "x",
      "yField": "y",
      "stack": false,
      "line": {
        "style": {
          "curveType": "monotone",
          "lineDash": [
            2,
            6
          ],
          "stroke": "#000"
        }
      },
      "point": {
        "style": {
          "size": [
            10,
            10
          ],
          "fill": "#000",
          "stroke": "#fff",
          "lineWidth": 2
        }
      }
    }
  ],
  "axes": [
    {
      "orient": "left",
      "seriesIndex": [
        0
      ],
      "width": 50,
      "label": {
        "style": {
          "fill": "#A7ADB2"
        }
      },
      "unit": {
        "visible": true,
        "text": "单位标签",
        "style": {}
      }
    },
    {
      "orient": "right",
      "seriesId": [
        "line"
      ],
      "grid": {
        "visible": false
      },
      "width": "20%",
      "label": {
        "style": {
          "fill": "#A7ADB2"
        }
      },
      "unit": {
        "visible": true,
        "text": "单位标签",
        "style": {
          "textAlign": "left",
          "fill": "#A7ADB2"
        }
      }
    },
    {
      "orient": "bottom",
      "label": {
        "visible": true,
        "style": {
          "fill": "#A7ADB2"
        }
      },
      "type": "band",
      "style": {
        "stroke": "#FF0000"
      },
      "domainLine": {
        "visible": true,
        "style": {
          "stroke": "#DBDEDF"
        }
      }
    }
  ],
  "legends": {
    "visible": true,
    "orient": "top",
    "item": {
      "spaceCol": 40
    }
  }
}

Current Behavior

Expected Behavior

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

Contributor guide