arun
arun

Reputation: 307

highcharts not refreshing chart when page refreshes

i have created a highchart and data i took it from csv file.The chart is working good and plotting fine.But my problem is when the page refreshes it is not taking the latest value from the csv file.It still displays the old chart.when i close the browser and re-open the chart works fine.Please help me how to reset/redraw with updated value from csv Below is my code. This problem IE not in firefox

var options = { chart: { renderTo: 'container', defaultSeriesType: 'line', marginRight: 130, marginBottom: 25 }, title: { text: 'Support Trending P1,P2 & P3' }, xAxis: { categories: [] },

              yAxis: {

                  showLastLabel:true,
                  tickInterval:5,
                  title: {
                          text: ""
                  }
                  },

              series: []
          };


          $.get('../data/trending.txt', function(data) {
              // Split the lines
              var lines = data.split(';');
              $.each(lines, function(lineNo, line) {
                  var items = line.split(',');

                  // header line containes categories
                  if (lineNo == 0) {
                      $.each(items, function(itemNo, item) {
                          if (itemNo > 0) options.xAxis.categories.push(item);
                      });
                  }

                  // the rest of the lines contain data with their name in the first position
                  else {
                      var series = {
                          data: []
                      };
                      $.each(items, function(itemNo, item) {
                          if (itemNo == 0) {
                              series.name = item;
                          } else {
                              series.data.push(parseFloat(item));
                          }
                      });

                      options.series.push(series);

                  }

              });

              var chart = new Highcharts.Chart(options);
          });


      });

Blockquote

Upvotes: 1

Views: 1735

Answers (1)

SteveP
SteveP

Reputation: 19103

It looks like your chart data is being cached, and not being refreshed by the browser. Without code, it's card to know how to fix it.

If you are using jquery $.ajax, there is an option

 cache:false

Which may help. http://api.jquery.com/jQuery.ajax/

Upvotes: 2

Related Questions