Devika N
Posts: 1
Nickname: devikanrgh
Registered: Feb, 2010
|
|
Re: Integrating Flex with a Java EE Application, Part II
|
Posted: Feb 19, 2010 1:34 AM
|
|
Hi,
Here is the code to add Fiji Chart dynamically.
import com.exadel.fiji.component.html.HtmlBarChart; import com.exadel.fiji.component.html.HtmlChartData; : :
HtmlChartData chartData =new HtmlChartData(); chartData.setValue(new MedalsBean().getNames());
HtmlBarChart chart=new HtmlBarChart(); chart.setValue(new MedalsBean().getMedalsData()); chartData.setParent(chart); chart.setBarColors(new MedalsBean().getColors()); chart.setWidth(200); chart.setHeight(200); chart.setId(chart.getClientId(_context)+1); chart.setRendered(true); : : But this chart is not rendering. i.e there is some error in Filling Data to chart.
Can anybody tell me how to add the Chart dynamically. Code For MedalBean
package fiji;
import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.Map;
import javax.annotation.PostConstruct;
public class MedalsBean { private Map<String, Integer[]> medalsData = new LinkedHashMap<String,Integer[]>(); private ArrayList<String> colors = new ArrayList<String>(); private ArrayList<String> names = new ArrayList<String>(); private Integer[] medalsChina = new Integer[]{51, 21, 28}; private Integer[] medalsUSA = new Integer[]{36, 38, 36}; private Integer[] medalsRussia = new Integer[]{23, 21, 28}; private String countrySelected; private String medalTypeSelected; private String medalCountSelected;
public String getCountrySelected() { return countrySelected; }
public void setCountrySelected(String countrySelected) { this.countrySelected = countrySelected; }
public String getMedalTypeSelected() { return medalTypeSelected; }
public void setMedalTypeSelected(String medalTypeSelected) { this.medalTypeSelected = medalTypeSelected; }
public String getMedalCountSelected() { return medalCountSelected; }
public void setMedalCountSelected(String medalCountSelected) { this.medalCountSelected = medalCountSelected; }
@PostConstruct private void init() { medalsData.put("China", medalsChina); medalsData.put("USA", medalsUSA); medalsData.put("Russia", medalsRussia); names.add("Gold"); names.add("Silver"); names.add("Bronze"); colors.add("#DAA520"); colors.add("#C0C0C0"); colors.add("#B87333"); } public Map<String, Integer[]> getMedalsData() { return medalsData; } public ArrayList<String> getColors() { return colors; } public ArrayList<String> getNames() { return names; } public Integer[] getMedalsChina() { return medalsChina; } public Integer[] getMedalsUSA() { return medalsUSA; } public Integer[] getMedalsRussia() { return medalsRussia; } }
Thanks in advance. Regards Devika.N
|
|