Wednesday, 15 June 2011

asp.net mvc - MVC HTML helper wrapper for jqPlot -


I want to make an MVC cover around jqPlot.

I have to make an assistant object to render to attract the required HTML container element and the necessary java script charts.

Something like this will appear:

  @ Html.jqPlot () .tartip (eChartTypes pie chart) .artdata (some data). Render Chart ();   

Now I am only in the initial design stage and I know that the JunkPlot object should be achieved in this way, the problem I have is with the Javascript which is the use of Jq Plot By emitting to attract the actual chart.

Suppose I will present the following script in my . Reader Chat () Method

  Public string RenderChart () {String chartcode = string.format (@ "& lt; script type =" text / javascript "src =" .. / Src / plugins / jqplot.canvasTextRenderer.min.js "& gt; & lt; / script & gt; & gt; script type =" text / javascript "src =" ../ src / plugins / jqplot.canvasAxisLabelRenderer.min .js "& gt; & lt; / script & gt; $ (document) .ready (function () {var plot1 = $ .jqplot ('{0}', [{1}]);});" This. Chartguide, this. Chart data); Return chart code; }   

The above is not the actual code, but only a general representation of the idea.

So the problem is that I do not want to throw helper to JS, leave the code in the HTML document body, except that I can not do it because becaus some necessary scripts html (best practice States may be as below).

Any suggestions? What would be the best way to emit a JS code using HTML Helper, then the situation is needed (like this one)?

I think, one would be possible solution to hear, in this case, the outline of the footer outline Or even finishing. That's why your code might give an event as an alternative to listening to an event and rendering it in that moment, but it is definitely dependent on the platform. I have also worked on a PHP cover, you can decoy it here: and have just implemented one assistant, but of course you can increase it :-)

Hope this Helps

No comments:

Post a Comment