[ 1 post ]

Casper Skovgaard

  • Username: casper.skovgaard
  • Joined: Wed Aug 19, 2009 5:43 am
  • Posts: 9
  • Offline
  • Profile

Charts reloads on every tab change

Post Posted: Fri Oct 28, 2011 12:53 am
+0-
I have 3 charts in a TabView, each chart in it's own tab. The charts uses 3 datasources to get data from the server. When the page is loaded all 3 charts are created and 3 calls are made to the server. This is just perfect and what I need.

The problem is when I click on a tab, then two calls are made to the server. One call for the chart that is currently shown and one for the chart that is going to be shown.

So if I'm on tab 1 and press tab 2. Then call is made for chart 1 and chart 2. I don't understand why this is happening??

I'm using yui 2.8.1

Here are some of the code:

Code:
var tabView = new YAHOO.widget.TabView("chartsTabs");


Code:
yEvent.onContentReady("chart2", function(){
   var ds = new YAHOO.util.DataSource("JSON_GetTopListErrorMetrics?Openagent&Type=ErrorLifeCycle");
   ds.connMethodPost = true;
   ds.responseType = YAHOO.util.DataSource.TYPE_JSON;
   ds.responseSchema = {
         resultsList: "Result",
         fields: ["Month", "MP", "MS", "WP"]
   };

   var yAxis = new YAHOO.widget.NumericAxis();
   yAxis.minimum = 0;
   yAxis.title = "Days";

   var xAxis = new YAHOO.widget.CategoryAxis();
   xAxis.title = "Month";
   
   var chart = new YAHOO.widget.ColumnChart( "chart2", ds, {
      xField: "Month",
      series: [
         {displayName: "MP", yField: "MP", style: {color: "#FF0000"}},
         {displayName: "MS", yField: "MS", style: {color: "#00FF00"}},
         {displayName: "WP", yField: "WP", style: {color: "#0000FF"}},
      ],
      yAxis: yAxis,
      xAxis: xAxis,      
      dataTipFunction: function(item, index, series){
         return series.displayName + " for " + item.Month + "\n" + item[series.yField] + " days"
      },
      style: {
...
      }
   });   
});


/Casper
  [ 1 post ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
cron