This is a migrated thread and some comments may be shown as answers.

Bar chart is not getting refeshed on page submit.

1 Answer 42 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Pritam
Top achievements
Rank 1
Pritam asked on 10 May 2013, 06:55 AM
Hello,
Im desiging a asp.net website using kendo Chart to display year and net benefit from a json file.
On button click i change the file contents but the graph doesn't show these changes.

 <div id="Div5" class="k-content absConf">
            <div class="chart-wrapper">
                <div id="chart"></div>
            </div>
            <script>

                function createChart() {
                    $("#chart").kendoChart({
                        dataSource: {
                            transport: {
                                read: {
                                    url: "js/123.json",
                                    dataType: "json"
                                   
                                }
                            },
                            sort: {
                                field: "year",
                                dir: "asc"
                               
                            }
                        },
                        title: {
                            text: "Net Benefit Chart"
                        },
                        legend: {
                            position: "top"
                        },
                        seriesDefaults: {
                            type: "column"
                        },


                        series:
                        [{
                            field: "val",
                            name: "Net Cash Benefit"

                        }],



                        categoryAxis: {
                            field: "year",
                            labels: {
                                rotation: -90
                            },
                            
                            majorGridLines: {
                                visible: true
                            },
                        },
                        valueAxis: {
                            labels: {
                                format: "Net Cash Benefit"
                            },
                            majorUnit: 5,
                            line: {
                                visible: true
                            
                            }
                           
                     
                        },
                        tooltip: {
                            visible: true,
                            format: "N0"
                        }
                    });

                    
                }
               
                $(document).ready(function () {
                    setTimeout(function () {
                        // Initialize the chart with a delay to make sure
                        // the initial animation is visible
                        createChart();
         }, 5);
                });
               

            </script>
        </div>


Ive attached the json too as an image.

Please help me.

1 Answer, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 10 May 2013, 02:41 PM
Hi Pritam,

In order to achieve the desired result you should re-read the Chart's dataSource. For example: 
$("#chart").data("kendoChart").dataSource.read();

More detailed information about the read() method is available in the corresponding documentation.

Kind regards,

Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Charts
Asked by
Pritam
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Share this question
or