Maryna
July 23rd, 2004, 05:08 AM
:m:
Hi all,
I have a question for you....I'm not able di draw a pie chart dynamically.
I have the Layer1 with a F3DPieChart, 4 input text and a button, I put 4 numer in the 4 inputtext (sum total = 100) and when I press the button I would like to see pie Chart to appear with 4 slices that rappresented my 4 numbers.unfortunately it doesn't happen.
This is the code on layer1:
[QUOTE]
var buttonListener = new Object();
buttonListener.click = function() {
var val;
var dp = new DataProviderClass();
val = _root.t1.text;
dp.addItem ({data:val, color:0xFF0000, label: "1"});
val = _root.t2.text;
dp.addItem ({data:val, color:0x00FF00, label: "2"});
val = _root.t3.text;
dp.addItem ({data:val, color:0x0000FF, label: "3"});
val = _root.t4.text;
dp.addItem ({data:val, color:0xFFFF00, label: "4"});
}
disegno = function(chart){
chart.removeAll();
chart.setDataProvider(dp);
delete dp;
}
_root.button.addEventListener("click", buttonListener);
Any help is apprecciate,
Maryna.
Hi all,
I have a question for you....I'm not able di draw a pie chart dynamically.
I have the Layer1 with a F3DPieChart, 4 input text and a button, I put 4 numer in the 4 inputtext (sum total = 100) and when I press the button I would like to see pie Chart to appear with 4 slices that rappresented my 4 numbers.unfortunately it doesn't happen.
This is the code on layer1:
[QUOTE]
var buttonListener = new Object();
buttonListener.click = function() {
var val;
var dp = new DataProviderClass();
val = _root.t1.text;
dp.addItem ({data:val, color:0xFF0000, label: "1"});
val = _root.t2.text;
dp.addItem ({data:val, color:0x00FF00, label: "2"});
val = _root.t3.text;
dp.addItem ({data:val, color:0x0000FF, label: "3"});
val = _root.t4.text;
dp.addItem ({data:val, color:0xFFFF00, label: "4"});
}
disegno = function(chart){
chart.removeAll();
chart.setDataProvider(dp);
delete dp;
}
_root.button.addEventListener("click", buttonListener);
Any help is apprecciate,
Maryna.