Using PlotKit (javascript) through C# -
I am relatively new to javascript, and although I know how to use it, I actually have mechanics behind it Did not understand it Stay here with me
I have to write a small app that takes a chart (in SVG) based on the data, taking as an XML file, which I actually want, except that it is in JavaScript Written while my current program is written in c # I did some goggles and found some articles that explain how to evaluate the simple javascript code with the network. Unfortunately, I do not know at all how to use VsaEngine to execute more complex javascript for which reference of other files is required. In fact, I want to be able to call something like C # for C #:
var layout = new plotkit.layout ("bar", {}); Layout.addDataset ("data", [[0, 0], [1, 1], [2, 2]]); Layout.evaluate (); Var canvas = cobbler.com. Gate Element ("article"); Var Graphics = New Plotkit SVG Andere (canvas, layout, {}); Var svg = SVGRenderer.SVG ();
And retract the SVG string for the chart. I do not know how to do this so that the above script knows where to look for all the necessary items. If I want to create a web page to do this, then I refer to some script headers /plotkit/Layout.js/plotkit/Layout.js, /plotkit/Canvas.js, etc. Javascript will work properly.
If anyone could explain how I would use plotkit through C #, or I could tell a more effective method to do this, then I would appreciate it.
EDIT: I know I'm not clear from this question - I need my C # program to emulate a JavaScript engine and actually use Plotkit Library without running a web browser. Is there any way to do this?
Plotkit is a JavaScript library that is intended to execute the client's web browser. C # is executed on the server to get information about communication between the two, whatever data you want to send to the plotkit on the server, then you can output to the HTML sent in that client.
Then in your C # code you will build the JSON object which will be passed to the adadacet method of plotkit.
... public partial default defaults: System.Web.UI.Page {protected string PlotKitData = "[]"; Secure Zero Page_load (Object Sender, EventAgds E) {if (Page.IsPostBack) PlotKitData = GenerateJSON (); ...
Then you will have something like this in your ASPX codefone.
& lt; Script & gt; Var layout = new plotkit.layout ("bar", {}); Layout.adetacet ("data", <% = PlotKitData%>;); Layout.evaluate (); Var canvas = cobbler.com. Gate Element ("article"); Var Graphics = New Plotkit SVG Andere (canvas, layout, {}); Var svg = SVGRenderer.SVG (); & Lt; / Script & gt;
Comments
Post a Comment