Nativescript-插件nativescript-ui-pro饼图刷新

时间:2018-11-12 13:05:39

标签: nativescript

我是这个平台上的新开发人员,我对图形(尤其是饼图)有问题,我试图保持动态,但是屏幕上的数据仍保持静态,您对此有什么解决方案?

devs这是我的代码

饼图

<chart:RadPieChart id="pieChart" height="300" allowAnimation="true" row="1" allowAnimation="true">
    <chart:RadPieChart.series>
      <chart:PieSeries selectionMode="DataPoint" expandRadius="0.4" outerRadiusFactor="0.7" items="{{ pieSource }}" seriesName="pie" valueProperty="Amount" legendLabel="Shift" showLabels="true">
        <chart:PieSeries.labelStyle>
          <chart:PointLabelStyle margin="15"/>
        </chart:PieSeries.labelStyle>
      </chart:PieSeries>
    </chart:RadPieChart.series>

    <chart:RadPieChart.legend>
      <chart:RadLegendView position="Right" title="Turnos - Partic." offsetOrigin="TopRight" width="110" enableSelection="true"/>
    </chart:RadPieChart.legend>
</chart:RadPieChart>

及以下是用于更新图形的代码

loadData(val1: number, val2: number, val3: number) {

        const v1 = val1;
        const v2 = val2;
        const v3 = val3;

        this.set("pieSource",
            [
                { Shift: "T1", Amount: v1 },
                { Shift: "T2", Amount: v2 },
                { Shift: "T3", Amount: v3 }
            ]);

        console.log(this.get("pieSource"));
    }

0 个答案:

没有答案