PDA

View Full Version : Ext.chart.CartesianChart.createAxis deletes o.labelRenderer, but why?



cplist
3 Sep 2010, 9:38 AM
Hi, all. I have a TabPanel, and in each tab is a Ext.chart.LineChart whose xAxis is defined as:

,xAxis : new Ext.chart.TimeAxis({
labelRenderer : function(date) { return date.format("d"); }
})

On an initial load, the xAxis is labeled perfectly. But if I change tabs and return to the original tab, the chart is refreshed but loses the labelRenderer completely, and I'm left w/ ugly timestamps.

I don't want to change the hideMode (although I realize this gets around the above problem -- but it creates others for me), and according to src, the labelRenderer is purposely deleted in Chart.js.

if(o.labelRenderer){
ref = this.getFunctionRef(o.labelRenderer);
o.labelFunction = this.createFnProxy(function(v){
return ref.fn.call(ref.scope, v);
});
delete o.labelRenderer;

Why is that? Once it's gone, it can't be referenced on a refresh. Getting rid of the delete makes my TabPanel & Chart marriage perfectly harmonious.

cplist
3 Sep 2010, 9:39 AM
Sorry, I see references to this in other threads. I'll just pay attention to those.