View Full Version : Can't change background of chart at runtime

14 Dec 2010, 10:24 AM
Hey Guys,

sry for my english, it's not my mother tounge =) i'm working on a linechart which shows actuall currency courses. I have also some buttons where you can change the period which is shown (for example, month, year etc.). Now i want to change the background image of the chart when i click on of those buttons.

I have a little extjs php class, but i think it's no problem reading it:

$chart = new extjs(false, 'chart.LineChart');
$chart->id = 'fatcms-currency-chart-flash';
$chart->store = $chart_store;
$chart->xField = 'date';
$chart->yField = 'course';

this is the most important code of the chart, everything is else is just style...

$week_btn = new extjs(false, 'Button');
$week_btn->text = '1 WEEK';
$week_btn->enableToggle = true;
$week_btn->toggleGroup = 'chart-button';
$week_btn->on('click', 'function(b, e){
var s = Ext.StoreMgr.item("fatcms-currency-chart-store");
var c = Ext.getCmp("fatcms-currency-chart-flash");
c.body.setStyle("background", "blue");
s.baseParams.period = "1 week";

and this is the button which should load the chart (c variable) and change the background, but it doesn't work. Maybe you can help me!