VChart icon indicating copy to clipboard operation
VChart copied to clipboard

[Feature] 瀑布图总计标签在同时有正负值时,显示位置需要优化

Open xuefei1313 opened this issue 1 year ago • 0 comments

What problem does this feature solve?

image

example

const spec = {
  "direction": "vertical",
  "type": "common",
  "color": [
    "#61BA95",
    "#335B4A",
    "#7A94BF",
    "#2E5599",
    "#B9A582",
    "#735A40",
    "#BC9B44",
    "#99533D",
    "#809E9D",
    "#2E8582"
  ],
  "series": [
    {
      "type": "waterfall",
      "stack": true,
      "direction": "vertical",
      "xField": "_editor_dimension_field",
      "yField": "_editor_value_field",
      "dataId": "waterfall",
      "id": "series-waterfall",
      "seriesField": "_editor_type_field",
      "total": {
        "type": "field",
        visible: true,
        "tagField": "_editor_waterfall_total",
        "valueField": "_editor_waterfall_total_value"
      },
      stackLabel: {
        visible: false
      },
      totalLabel: {
        visible: true,
        position: 'top',
      },
      label: {
        visible: true,
      },
      "addLastTotal": true
    }
  ],
  "legends": {
    "id": "legend-discrete",
    "visible": true,
    "autoPage": false,
    "position": "start",
    "interactive": false,
    "item": {
      "label": {
        "style": {
          "fill": "#1F2329",
          "fontSize": 16
        }
      }
    }
  },
  "region": [
    {
      "id": "region-0"
    }
  ],
  "tooltip": {
    "visible": true,
    "mark": {},
    "dimension": {}
  },
  "axes": [
    {
      "orient": "left",
      "id": "axis-left",
      "type": "linear",
      "label": {
        "autoLimit": false,
        "style": {
          "fill": "#1F2329",
          "fontSize": 16
        },
        "formatMethod": null
      },
      "domainLine": {
        "visible": true,
        "style": {
          "stroke": "#000000"
        }
      },
      "tick": {
        "visible": true,
        "style": {
          "stroke": "#000000"
        }
      },
      "grid": {
        "visible": false,
        "style": {
          "stroke": "#bbbfc4"
        }
      },
      "autoIndent": false,
      "maxWidth": null,
      "maxHeight": null
    },
    {
      "orient": "bottom",
      "id": "axis-bottom",
      "type": "band",
      "label": {
        "autoLimit": false,
        "style": {
          "fill": "#1F2329",
          "fontSize": 16
        }
      },
      "domainLine": {
        "visible": true,
        "style": {
          "stroke": "#000000"
        },
        "onZero": true
      },
      "tick": {
        "visible": true,
        "style": {
          "stroke": "#000000"
        }
      },
      "grid": {
        "visible": false,
        "style": {
          "stroke": "#bbbfc4"
        }
      },
      "autoIndent": false,
      "maxWidth": null,
      "maxHeight": null,
      "trimPadding": false,
      "paddingInner": [
        0.2,
        0
      ],
      "paddingOuter": [
        0.2,
        0
      ]
    }
  ],
  "data": [
    {
      "id": "waterfall",
      "sourceKey": "total",
      "values": [
        {
          "_editor_dimension_field": "x1",
          "_editor_value_field": 20,
          "_editor_type_field": "a_fieldLink_正值",
          "_editor_type_field_waterfall_raw": 20,
          "_editor_dimension_field_waterfall_raw": "x1"
        },
        {
          "_editor_dimension_field": "x2",
          "_editor_value_field": -23,
          "_editor_type_field": "a_fieldLink_负值",
          "_editor_type_field_waterfall_raw": -23,
          "_editor_dimension_field_waterfall_raw": "x2"
        },
        {
          "_editor_dimension_field": "x3",
          "_editor_value_field": 26,
          "_editor_type_field": "a_fieldLink_正值",
          "_editor_type_field_waterfall_raw": 26,
          "_editor_dimension_field_waterfall_raw": "x3"
        },
        {
          "_editor_dimension_field": "x1",
          "_editor_value_field": 20,
          "_editor_type_field": "b_fieldLink_正值",
          "_editor_type_field_waterfall_raw": 20,
          "_editor_dimension_field_waterfall_raw": "x1"
        },
        {
          "_editor_dimension_field": "x2",
          "_editor_value_field": 24,
          "_editor_type_field": "b_fieldLink_正值",
          "_editor_type_field_waterfall_raw": 24,
          "_editor_dimension_field_waterfall_raw": "x2"
        },
        {
          "_editor_dimension_field": "x3",
          "_editor_value_field": 29,
          "_editor_type_field": "b_fieldLink_正值",
          "_editor_type_field_waterfall_raw": 29,
          "_editor_dimension_field_waterfall_raw": "x3"
        },
        {
          "_editor_waterfall_total": true,
          "_editor_dimension_field": "_editor_waterfall_total",
          "_editor_type_field": "_editor_waterfall_total"
        }
      ],
      "fields": {
        "_editor_dimension_field": {
          "domain": [
            "x1",
            "x2",
            "x3",
            "_editor_waterfall_total"
          ],
          "sortIndex": 0
        }
      }
    }
  ],
  "labelLayout": "region",
  "customMark": [],
  "width": 640,
  "height": 360,
  "background": "transparent"
};

What does the proposed API look like?

没有新增api

xuefei1313 avatar Jul 12 '24 02:07 xuefei1313