|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 8/31/2008 3:10:57 AM
Posts: 3,
Visits: 18
|
|
Hi,
In my J2EE application, servlets are used for generating xml data. I do not find any DTD or a Java API for building easily xml description of chart . So I took few days for building a java API. Now thanks to the Java API, the generation of xml data for fusion chart is look like this:
------------------------------------------------------------------------------------------
import com.raisepartner.chartfusion.api.bar2d.Bar2D;
import com.raisepartner.chartfusion.api.bar2d.Set;
...
public String getXMLData() {
Bar2D chart = new Bar2D();
chart.setCaption("Monthly Sales Summary");
chart.setSubCaption("For the year 2006");
chart.setXAxisName("Month");
chart.setYAxisName("Sales");
chart.setNumberPrefix("$");
setValue(chart, "Jan", "17400");
setValue(chart, "Feb", "19800");
setValue(chart, "Mar", "21800");
setValue(chart, "Apr", "23800");
setValue(chart, "May", "29600");
setValue(chart, "Jun", "27600");
setValue(chart, "Jul", "31800");
setValue(chart, "Aug", "39700");
setValue(chart, "Sep", "37800");
setValue(chart, "Oct", "21900");
setValue(chart, "Nov", "32900");
setValue(chart, "Dec", "39800");
return chart.toString();
}
------------------------------------------------------------------------------------------
It generates the xml corresponding to the exemple of the documentation
http://www.fusioncharts.com/Docs/Contents/FirstChart.html
My solution avoids lot of syntax error and permits to develop quickly in Java. As I use GWT for building the web interface, all my application is written in Java !
The Java API is generated from meta descriptions : .xls files. Excel files have been written manually by a copy paste from the documentation. But if the fusion chart team had an xml source of the documentation, it would be very easy to rebuild automatically the .xls files or the API directly.
All the code has been publish on the LGPL licence on google code :
http://code.google.com/p/gwt-fusionchart/
Sebastien Chassande
Raise Partner
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 4/17/2008 7:19:40 AM
Posts: 12,
Visits: 23
|
|
| Maybe your solution support MySQL data base? For example i using cron for writing data to data base and next JAVA API could convert data to xml format
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 7/17/2008 12:45:14 PM
Posts: 1,
Visits: 2
|
|
Hi Seb,
nice work!!
Could you explain us what are you doing in the 'setValue' method of your sample?
import com.raisepartner.chartfusion.api.bar2d.Bar2D;
import com.raisepartner.chartfusion.api.bar2d.Set;
...
public String getXMLData() {
Bar2D chart = new Bar2D();
chart.setCaption("Monthly Sales Summary");
chart.setSubCaption("For the year 2006");
chart.setXAxisName("Month");
chart.setYAxisName("Sales");
chart.setNumberPrefix("$");
setValue(chart, "Jan", "17400");
setValue(chart, "Feb", "19800");
setValue(chart, "Mar", "21800");
setValue(chart, "Apr", "23800");
setValue(chart, "May", "29600");
setValue(chart, "Jun", "27600");
setValue(chart, "Jul", "31800");
setValue(chart, "Aug", "39700");
setValue(chart, "Sep", "37800");
setValue(chart, "Oct", "21900");
setValue(chart, "Nov", "32900");
setValue(chart, "Dec", "39800");
return chart.toString();
}
Thanks in advance!!
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 8/31/2008 3:10:57 AM
Posts: 3,
Visits: 18
|
|
|
|
|