Hi
I am a new bee just into android development. I wanted to render fusioncharts in android 2.2 where flash plug in is not available.
I tried to use simple javascript and other html5 techniques to do so. But failed to render the chart using WebView. Let me know how to proceed ASAP.
my code follows :
<html>
<head>
<title>My First chart using FusionCharts - Using pure JavaScript
</title>
<script type="text/javascript" src="FusionCharts/FusionCharts.js">
</script>
</head>
<body>
<div id="chartContainer">FusionCharts will load here!
<script type="text/javascript">
<!--
FusionCharts.setCurrentRenderer('javascript');
var myChart = new FusionCharts("Pie2D.swf?dataURL=Data.xml","myChartId", "560", "400", "0", "1");
myChart.setDataURL("Data.xml");
myChart.render("chartContainer");
// -->
</script>
</div>
</body>
and the java class as -
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
etContentView(R.layout.main);
web=(WebView)findViewById(R.id.webView1);
web.loadUrl(file:///android_asset/www/index.html);
}
}
And main.xml as :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="
http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="@string/hello" />
<WebView android:id="@+id/webView1" android:layout_width="match_parent"
android:layout_height="match_parent"></WebView>
</LinearLayout>
Thanks in advance
Sneha