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] When updateData, legend does not update #769

Closed
kkxxkk2019 opened this issue Sep 4, 2023 · 0 comments · Fixed by #771
Closed

[Bug] When updateData, legend does not update #769

kkxxkk2019 opened this issue Sep 4, 2023 · 0 comments · Fixed by #771
Assignees
Labels
bug Something isn't working
Milestone

Comments

@kkxxkk2019
Copy link
Collaborator

Version

latest

Link to Minimal Reproduction

none

Steps to Reproduce

  const spec = {
    type: 'pie',
    data: [
      {
        id: 'pieData',
        values: pieData
      }
    ],
    outerRadius: 0.8,
    innerRadius: 0.5,
    padAngle: 0.6,
    valueField: 'value',
    categoryField: 'type',
    // color: {
    //   id: 'color',
    //   type: 'linear',
    //   range: ['#1664FF', '#B2CFFF', '#1AC6FF', '#94EFFF'],
    //   domain: [
    //     {
    //       dataId: 'pieData',
    //       fields: ['value']
    //     }
    //   ]
    // },
    pie: {
      style: {
        cornerRadius: 10
        // fill: {
        //   scale: 'color',
        //   field: 'value'
        // }
      }
    },
    legends: {
      visible: true,
      orient: 'left'
      // data: (data, scale) => {
      //   return data.map(datum => {
      //     const pickDatum = pieData.find(pieDatum => pieDatum.type === datum.label);

      //     datum.shape.fill = scale.scale(pickDatum?.value);
      //     return datum;
      //   });
      // }
    },
    label: {
      visible: true
    }
  };

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

Then call

vchart.updateData('pieData', [
  {type: "AAAA", value: 30},
{type: "BBBB", value: 10}

Current Behavior

legend does not change

image

Expected Behavior

should change

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

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.

1 participant