weixin_33738555 2015-12-01 16:48 采纳率: 0%
浏览 12

剑道图不会刷新

I'm using a Kendo Chart, the first call works fine but when I call setInterval(getCharts, 800); the charts brings back the old results every time. If I refresh the page the chart brings the updates results. What am i doing wrong?

If I call $(#chartid).data('KendoChart').datasource.read(); it brings error datasource is undefined

 function myCallback(result) {
        // Code that depends on 'result'
        totalcountvar = result;
        return totalcountvar;
    }


    function foo(callback, id) {
        $.ajax({
            type: "POST",
            url: "Data/OutageCountHandler.ashx?id=" + id,
            data: "{}",
            async: false,
            contentType: "text/json; charset=utf-8",
            dataType: "json",
            success: callback
        });
    }
    function createChart2(chartid, c_title, fieldName, q_id) {

        if (q_id == 2) { foo(myCallback, 4); c_title = c_title + totalcountvar; }
        if (q_id == 3) { foo(myCallback, 2); c_title = c_title + totalcountvar; }
        if (q_id == 4) { foo(myCallback, 3); c_title = c_title + totalcountvar; }


        var sharableDataSource = new kendo.data.DataSource({
            transport: {
                read: {
                    url: "Data/ChartDataHandler.ashx?id=" + q_id,
                    dataType: "json"
                }
            }
        });
        // Bind data to Chart

            $("#" + chartid).kendoChart({
                theme: "moonlight",
                chartArea: {
                    width: 800,
                    height: 400,
                },

                title: {
                    text: c_title
                },
                dataSource: sharableDataSource,
                series: [{
                    field: fieldName.replace(/\s+/g, ''),
                    name: fieldName,
                    color: "#3074D8",
                    noteTextField: "Type",
                    notes: {
                        icon: {
                            visible: false
                        },
                        line: {
                            length: 20,
                            color: "transparent"
                        },
                        label: {

                           field:"Type",
                            position: "outside"
                        }
                    }
                }],
                seriesDefaults: {
                    type: "column",
                    labels: {
                        visible: true,
                        background: "transparent"
                    }
                },
                categoryAxis: {
                    field: "Area",

                },
                tooltip: {
                    visible: true,
                    background: "white",
                    format: "{0}",
                    template: "#= series.name #: #= value #"
                },
                legend: {
                    position: "bottom"
                }
            });



        }
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 #MATLAB仿真#车辆换道路径规划
    • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
    • ¥15 数据可视化Python
    • ¥15 要给毕业设计添加扫码登录的功能!!有偿
    • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
    • ¥15 微信公众号自制会员卡没有收款渠道啊
    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘