ant-design-charts-blazor icon indicating copy to clipboard operation
ant-design-charts-blazor copied to clipboard

How to change data

Open KnightYyj opened this issue 4 years ago • 3 comments

如何动态改变数据 There are no examples 请求接口之后 怎么重新渲染,找了半天也不知道怎么做

KnightYyj avatar Dec 12 '20 17:12 KnightYyj

I made a class for the data and initialized it first with 0.

    private Pie[] data =
   {
        new Pie
        {
            Type = "Good",
            Value = 0,
        },
        new Pie
        {
            Type = "Failed",
            Value = 0,
        },
        new Pie
        {
            Type = "In Progress",
            Value = 0,
        },
    };

After this i created a method on OnInitializedAsync() to fill in the value:

        data.First(x => x.Type == "Good").Value = countOkChecks;
        data.First(x => x.Type == "Failed").Value = countNotOkChecks;
        data.First(x => x.Type == "In Progress").Value = countInProgressChecks;

image

ClumsyPenguin avatar Jan 22 '21 10:01 ClumsyPenguin

同问,数据更新后图标不更新

my522cn avatar Mar 01 '21 06:03 my522cn

终于,昨天找到了实例: https://ant-design-blazor.gitee.io/zh-CN/charts/generalconfigration#components-generalconfigration-demo-interop

my522cn avatar Mar 02 '21 00:03 my522cn