I wrote an app a while ago in Java using the graphics library java fx. The app generates diagrams like the following examples:
I want to port this app to run on the web. I was thinking of using Javascript to draw an svg file on the browser. How would I go about doing this?
Related
I want to visualized data using collapsible tree provided by d3.js. I'm following the tutorial http://www.appstoremarketresearch.com/articles/d3-js-pie-chart-android-webview/.
Unfortunately, i'm not sure how to start from scratch (installing d3.js) and how to run it in android apps. any reliable references? thanks.
The answer is the post you linked itself, see section Make a Pie Chart in an Android Fragment and WebView:
To make D3.js charts in an Android application, first download the
D3.js source from the D3.js home page.
Then
In your app project path, create a directory for JavaScript assets: Android-D3jsPieChart/assets/js
Copy the minified d3.min.js source file from your download into Android-D3jsPieChart/assets/js
Create a directory for HTML assets: Android-D3jsPieChart/assets/html
Create file Android-D3jsPieChart/assets/html/piechart.html. Copy this code into the new file:
D3.js Pie Chart
The code above allows you to use d3 library from assets in your webview. After you have done these setups, you can proceed to any normal d3.js tutorials and use them in your webview, for JavaScript files (.js), you can continue to put them in assets folder.
I have a small web application done in HTML/JS. I wanted to use a Python Visualization inside in that application.
Executing Python component gives the HTML content, which I want to embedded inside the application.
How could I do this? How to call a Python Script inside JS?
The easiest way to is to a have Python web microframework doing the data/HTML serving for you. Popular framework for just making tiny data-serving applications is Flask.
Here is an example which serves data from Flask and then uses Bokeh visualization framework to do plots out of it.
Bokeh itself has something called "plot server" designed for serving plot graph data, but as I can see this is vertically integrated with Bokeh visulazation library and might not suit for your use case.
I am writing a simple web app using NancyFX and the Razor view engine. I have little components in my web app that are having css, html and JavaScript. Each small component has its own folder in my Visual Studio solution.
When compiling I would like to pack together all the JavaScript code into one large file and include only that in my master-page. Something similar to ruby's sprocket gen would be the best.
Is there any solution for this problem?
I have some scripts written with d3.js that generate SVG charts. I'd like to generate those charts with a standalone program -- what is the easiest way I can convert those scripts to run in batch mode, without a browser?
You could:
Convert this to a node.js program. You'd have access to the filesystem and would be able to save generated SVGs easily. You'd need node-canvas to replace the HTML canvas. See this d3 example to get started using d3 with node.
You could use the filesystem APIs in Chrome with your existing scripts to write files to the hard disk. This may be easier, because you would just need to implement the filesystem code on top of what you have already. See this html5rocks article for information on writing to the local file system.
I'm using Raphael js to create some graphics on the client.
But I'd now like to be able to do the same thing directly on the server to be able to create them and store them in batch.
I've found solutions where the SVG form Raphael is fetched from the client, but not any completely server-side.
Does any one have experience using Raphael js server side only (with Rhino for instance)?
Thanks!
Take a look at PhantomJS - it's basically a full webkit browser you can run headless from the command line and render the output to a PNG.
There is actually an example using Raphael on the Quickstart guide.
phantomjs rasterize.js http://raphaeljs.com/polar-clock.html clock.png