Table of Contents
<html> <body> <div data-role="page" data-theme="b"> <form> <div data-role="content"> <h1 id="label">@Medel.Text</h1> <input type="button" name="chart" value="Chart" >Step 8
Include the fusioncharts.js and fusioncharts.charts.js libraries within <head> tag of RazorView.cshtml.Step 9
Declare a JavaScript function, getChart(), and define the entire FusionCharts JSON code (chart data) there.Step 10
In MainActivity.cs file create a WebView object instance. Set the JavaScript.Enabled property to true for WebView settings, as shown below:var webView = FindViewById<WebView>(Resource.Id.webView); webView.Settings.JavaScript.Enabled = true;Step 11
Render the view that has been generated from RazorView. This can be done by including the following code in MainActivity.cs:var model = new Model1() { Text = "Please click chart button to render chart..." }; var template = new RazorView() { Model = model }; var page = template.GenerateString();Step 12
Load the rendered HTML into the view with a base URL that points to the root of the bundled Assets folder, as shown in the code below:webView.LoadDataWithBaseURL("file:///android_asset", page, "text/html", "UTF-8", null);Step 13
Define the subclass of the WebViewClient to render the view generated from RazorView.cshtml as shown below:private class HybridWebViewClient: WebViewClient { public override bool ShouldOverrideUrlLoading(WebView webView, string url) { // If the URL is not our own custom scheme, just let the webView load the URL as usual var scheme = "hybrid:"; if (!url.StartWith(scheme)) return false; // This handler will treat everything between the protocol and "?" as the method name. The querystring has all f the parameters. var resources = url.Substring(scheme.Length).Split('?'); var method = resources[0]; var parameters = System.Web.HttpUtility.PparseQueryString(resources[1]); return true; } }Step 14
Save the application and run the project using the Android_Accelerated_x86 6.0 emulator. Now, you are ready to run the application created. While you are in the emulator, press ctrl + f5. to run and start the FusionCharts app as shown in the image below:Viewing the Chart
We are all set to render the chart now! All you need to do is click the Chart button, you should be able to see your output. The output should look as shown in the image below:
We’re excited to announce the upcoming release of FusionCharts v4.1—a groundbreaking step forward in the…
Have you ever been overwhelmed by a massive data set and wondered, "How do I…
If you’ve ever tried to make sense of the stock market, you’ve probably come across…
Imagine you’re comparing the sales performance of your top product lines across different regions, or…
Have you ever spent hours buried in documentation, hunting for a specific piece of code?…
Do you feel like your data is a cryptic puzzle, locked away from revealing its…