Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] label 默认防重叠策略不符合预期 #1956

Closed
kkxxkk2019 opened this issue Jan 8, 2024 · 1 comment · Fixed by #2026
Closed

[Bug] label 默认防重叠策略不符合预期 #1956

kkxxkk2019 opened this issue Jan 8, 2024 · 1 comment · Fixed by #2026
Assignees
Labels
bug Something isn't working

Comments

@kkxxkk2019
Copy link
Collaborator

kkxxkk2019 commented Jan 8, 2024

Version

latest

Link to Minimal Reproduction

none

Steps to Reproduce

const spec = {
  "direction": "vertical",
  "type": "common",
  "color": [
    "#61BA95",
    "#335B4A",
    "#7A94BF",
    "#2E5599",
    "#B9A582",
    "#735A40",
    "#BC9B44",
    "#99533D",
    "#809E9D",
    "#2E8582"
  ],
  "series": [
    {
      "type": "bar",
      "stack": true,
      "percent": true,
      "bar": {
        "state": {
          "hover": {
            "stroke": "#000",
            "lineWidth": 1
          }
        }
      },
      "label": {
        "visible": true,
        "position": "inside",
        overlap: true,
        smartInvert: true
      },
      "xField": "_editor_dimension_field",
      "yField": "_editor_value_field",
      "dataId": "0",
      "seriesField": "_editor_type_field"
    }
  ],
  "legends": {
    "id": "legend-discrete",
    "visible": true,
    "autoPage": false,
    "position": "start",
    "interactive": false
  },
  "region": [
    {
      "id": "region-0",
      "style": {}
    }
  ],
  "tooltip": {
    "visible": true
  },
  "axes": [
    {
      "orient": "left",
      "id": "axis-left",
      "type": "linear",
      "label": {
        "autoLimit": false
      },
      "maxWidth": null,
      "maxHeight": null
    },
    {
      "orient": "bottom",
      "id": "axis-bottom",
      "type": "band",
      "label": {
        "autoLimit": false
      },
      "maxWidth": null,
      "maxHeight": null,
      "trimPadding": false
    }
  ],
  "data": [
    {
      "id": "0",
      "sourceKey": "total",
      "values": [
        {
          "_editor_dimension_field": "D01",
          "_editor_value_field": "  54.8",
          "_editor_type_field": " PM2_5"
        },
        {
          "_editor_dimension_field": "D02",
          "_editor_value_field": " 112.1",
          "_editor_type_field": " PM2_5"
        },
        {
          "_editor_dimension_field": "D03",
          "_editor_value_field": "  63.6",
          "_editor_type_field": " PM2_5"
        },
        {
          "_editor_dimension_field": "D04",
          "_editor_value_field": "  37.6",
          "_editor_type_field": " PM2_5"
        },
        {
          "_editor_dimension_field": "D05",
          "_editor_value_field": "  79.7",
          "_editor_type_field": " PM2_5"
        },
        {
          "_editor_dimension_field": "D06",
          "_editor_value_field": " 137.9",
          "_editor_type_field": " PM2_5"
        },
        {
          "_editor_dimension_field": "D07",
          "_editor_value_field": " 120.1",
          "_editor_type_field": " PM2_5"
        },
        {
          "_editor_dimension_field": "D08",
          "_editor_value_field": " 103.3",
          "_editor_type_field": " PM2_5"
        },
        {
          "_editor_dimension_field": "D09",
          "_editor_value_field": " 394.8",
          "_editor_type_field": " PM2_5"
        },
        {
          "_editor_dimension_field": "D10",
          "_editor_value_field": " 199.5",
          "_editor_type_field": " PM2_5"
        },
        {
          "_editor_dimension_field": "D11",
          "_editor_value_field": "  72.3",
          "_editor_type_field": " PM2_5"
        },
        {
          "_editor_dimension_field": "D12",
          "_editor_value_field": "  51.1",
          "_editor_type_field": " PM2_5"
        },
        {
          "_editor_dimension_field": "D13",
          "_editor_value_field": " 112.0",
          "_editor_type_field": " PM2_5"
        },
        {
          "_editor_dimension_field": "D14",
          "_editor_value_field": " 174.5",
          "_editor_type_field": " PM2_5"
        },
        {
          "_editor_dimension_field": "D15",
          "_editor_value_field": " 130.5",
          "_editor_type_field": " PM2_5"
        }
      ]
    }
  ],
  "width": 640,
  "height": 360,
  "background": "transparent"
};

const vchart = new VChart(spec, { dom: CONTAINER_ID });
vchart.renderAsync();

// Just for the convenience of console debugging, DO NOT COPY!
window['vchart'] = vchart;

Current Behavior

image

1. 文本为居中(向右偏移)
2. 显示配置 overlap: true 的效果和没有配置不一致

不配置 overlap: true
image image

Expected Behavior

NA

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

@kkxxkk2019 kkxxkk2019 added the bug Something isn't working label Jan 8, 2024
@kkxxkk2019 kkxxkk2019 changed the title [Bug] label 默认放重叠策略不符合预期 [Bug] label 默认防重叠策略不符合预期 Jan 8, 2024
@xiaoluoHe
Copy link
Contributor

@kkxxkk2019 不居中是因为数值字符串以空格开头了
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants