sure i will send it
first i am sending jsp side code for xml data
HashMap mapChartAttributes = new HashMap();//map for chart attributes
mapChartAttributes.put("bgcolor","FFFFFF");
mapChartAttributes.put("enablesmartLabels","0");
mapChartAttributes.put("showToolTip","0");
mapChartAttributes.put("showPercentValues","0");
mapChartAttributes.put("palette","2");
mapChartAttributes.put("pieRadius","90");
mapChartAttributes.put("showLegend","1");
mapChartAttributes.put("legendPosition","RIGHT");
HashMap mapChartData = new HashMap();//map for chart data
mapChartData.put("pieLabels",countName);
mapChartData.put("pieValues",countValue);
mapChartData.put("pieColors",colorValue);
HashMap mapProperties = new HashMap();//map for misc properties
mapProperties.put("showLabels","false");
mapProperties.put("showColors","true");
mapProperties.put("enableLinks","false");
EcFusionChartBean chartbean = new EcFusionChartBean();
String xmlString = chartbean.getXMLDataForPieChart(mapChartAttributes,mapChartData,mapProperties);
i am passing this xmlstring into my code
and java code is
public String getXMLDataForPieChart(Map chartAttributes,Map chartData,Map miscProperties) throws UnsupportedEncodingException
{
ArrayList aListColors = new ArrayList();
ArrayList aListLinks = new ArrayList();
int colCount = 0;
String pieLabels = (String)chartData.get("pieLabels");
String pieValues = (String)chartData.get("pieValues");
String pieColors = (String)chartData.get("pieColors");
String pieLinks = (String)chartData.get("pieLinks");
Iterator itrchart = chartAttributes.keySet().iterator();
String xmlData = "<Chart ";
while (itrchart.hasNext())
{
String chartAttribute = (String)itrchart.next();
String chartAttributeValue = (String)chartAttributes.get(chartAttribute);
xmlData += chartAttribute + "=" + "'" + chartAttributeValue + "' ";
}
xmlData += ">";
if (pieColors!= null)
{
StringTokenizer strColors = new StringTokenizer(pieColors,",");
while (strColors.hasMoreTokens())
{
String chartColor = strColors.nextToken();
chartColor = chartColor.substring(chartColor.indexOf("#")+1);
aListColors.add(chartColor);
}
}
if (pieLinks != null)
{
StringTokenizer strLinks = new StringTokenizer(pieLinks,",");
while (strLinks.hasMoreTokens())
{
String chartLink = strLinks.nextToken();
aListLinks.add(chartLink);
}
}
String showLabels = null;
String showColors = null;
String enableLinks = null;
if (miscProperties != null && !miscProperties.isEmpty())
{
showLabels = (String)miscProperties.get("showLabels");
showColors = (String)miscProperties.get("showColors");
enableLinks = (String)miscProperties.get("enableLinks");
}
StringTokenizer strValues = new StringTokenizer(pieValues,",");
StringTokenizer strLabels = new StringTokenizer(pieLabels,",");
while (strValues.hasMoreTokens())
{
String chartValue = strValues.nextToken();
String chartLabel = strLabels.nextToken();
xmlData += "<set value='" + chartValue + "' ";
if (showLabels != null && showLabels.equalsIgnoreCase("true"))
{
xmlData += " label='" + chartLabel + "'";
}
if (showColors != null && showColors.equalsIgnoreCase("true"))
{
xmlData += " color='" + aListColors.get(colCount) + "'";
}
if (enableLinks != null && enableLinks.equalsIgnoreCase("true"))
{
xmlData += " link='" + EgURLEncoder.encode((String)aListLinks.get(colCount),"UTF-8") + "'";
}
xmlData += " />";
colCount++;
}
xmlData +="<styles>"+"<definition>"+"<style name='myLegendFont' type='font' size='11' color ='FFFFFF' bold='1'/>"+"</definition>"+"<application>"+"<apply toObject='Legend' styles='myLegendFont' />"+"</application>"+"</styles>";
xmlData += "</Chart>";
return xmlData;
}
waiting for ur reply!