about the use of html.raw and the easy solution:

change your function to

public static htmlstring displaychart(this htmlhelper helper, ...)
    return new htmlstring(result);

you then may use @html.displaychart(...) in your razor views.

also, please make sure that options.divname, options.title, options.subtitle etc. are properly escaped - a title like everybody's favorite chart will break the output.

Related Query

More Query from same tag