Why does my html template not appear in the webview?

I would like to load a local Chart-Template into a WebView.

public override void ViewDidLoad ()
{
    base.ViewDidLoad ();

    this.Title = "BarChart";

    HTMLContentProvider htmlProvider = new HTMLContentProvider();
    String contentDirectoryPath = Path.Combine(NSBundle.MainBundle.BundlePath, "www/");
    Dictionary<String,Object> dict = new Dictionary<String,Object> ();
    View.AddSubview (webViewChart);
    View.AddSubview (webViewFormel);

    //Json Object für den Graphen erzeugen
    Object[] daten = new Object[] {
        new Object[] {  new { value = 120000, color = "green"} ,
            new { value = 5000, color = "black" }},

        new Object[]{   new { from = -25000, value = 150000, color = "red" } },

        new Object[]{   new { value = 25000, from = -25000, color = "blue" } }
    } ;

    dict.Add ("context",daten);
    dict.Add ("spacing", 0.2);


    //HTML String von HTML Provider mit Mustache hohlen
    String htmlChart = htmlProvider.GetTemplate("barChart", "daten", dict);
    String htmlFormel = htmlProvider.GetTemplate("betriebsergebnis");

    webViewFormel.LoadHtmlString(htmlFormel, new NSUrl(contentDirectoryPath,true));
    webViewFormel.ScalesPageToFit = true;
    //webViewFormel.LoadHtmlString(htmlFormel, new NSUrl(contentDirectoryPath, true));
    //webViewFormel.UserInteractionEnabled = false;

    webViewChart.LoadHtmlString(htmlChart, new NSUrl(contentDirectoryPath, true)); 
    webViewChart.ScalesPageToFit = true;

} 

The problem is that the last few lines of code do not appear in the webView and I don’t know why?


Source: html5

Leave a Reply