Chartjs-Js devexpress PieChart Series color runtime

0👍

Quick solution I found : visit devexpress support forum for More Details

Sample Code Download link

Code is

<div id="canvas-holder">
    <div id="pie"></div>
</div>

<script>
    var ds = [{ country: "On", area: 0 }];

    var pie = $("#pie").dxPieChart({
        size: { width: 500 },
        //palette: "bright",
        dataSource: ds,
        series: [{ argumentField: "country", valueField: "area" }],
        title: "Area of Countries",
        customizePoint: function (pointInfo) {
            if (pointInfo.value <= 0) {
                return {
                    color: "red"
                }
            }
            return {
                color: "green"
            }
        }
    }).dxPieChart("instance");

    var isVal = 0;

    setInterval(function () {           

        if (isVal == 0)
            isVal = 1;
        else
            isVal = 0;

        ds[0].area = 1;

        pie.option("dataSource", ds);

    }, 1000);

</script>

Leave a comment