VChart icon indicating copy to clipboard operation
VChart copied to clipboard

[Bug] 桑基图 seriesField 不生效

Open xiaoluoHe opened this issue 1 year ago • 0 comments

Version

1.11.0

Link to Minimal Reproduction

Steps to Reproduce

const spec = {
  type: 'sankey',
  data: [
    {
      values: [
        {
          nodes:[
                {
                    "key": "A",
                    type:'1',
                },
                {
                    "key": "B",
                    type:'1',

                },
                {
                    "key": "C",
                    type:'2'
                },
                {
                    "key": "D",
                    type:'2'
                },
                {
                    "key": "E",
                    type:'3'
                },
                {
                    "key": "F",
                    type:'3'
                },
                {
                    "key": "G",
                    type:'3'
                }
            ],
          links: [
                {
                    "from": "A",
                    "to": "D",
                    "key": "A",
                    "value": 400
                },
                {
                    "from": "B",
                    "to": "D",
                    "key": "B",
                    "value": 400
                },
                {
                    "from": "C",
                    "to": "D",
                    "key": "C",
                    "value": 500
                },
                {
                    "from": "D",
                    "to": "F",
                    "key": "D",
                    "value": 800
                },
                {
                    "from": "C",
                    "to": "E",
                    "key": "C",
                    "value": 100
                },
                {
                    "from": "E",
                    "to": "G",
                    "key": "E",
                    "value": 100
                },
                {
                    "from": "D",
                    "to": "G",
                    "key": "D",
                    "value": 500
                }
            ]
        }
      ]
    }
  ],
  categoryField: 'key',
  valueField: 'value',
  sourceField: 'from',
  targetField: 'to',
  seriesField:'type',

  nodeAlign: 'justify',
  nodeGap: 8,
  nodeWidth: 15,
  minNodeHeight: 4,
  nodeKey: datum => datum.key,
  iterations: 20,

  label: {
    visible: true,
    style: {
      fontSize: 10,
      fill: 'black'
    }
  },
};

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

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

Current Behavior

image

Expected Behavior

颜色按照 seriesField 分组着色

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

xiaoluoHe avatar May 14 '24 06:05 xiaoluoHe