Create and draw (un)ordered graphs - javascript

Is there any JavaScript app to create and display (un)ordered graphs with possibility to POST drawing as JSON array which I can catch and store in Django db?

Have a look at the d3.js force-directed graph example. D3 works using javascript to control SVG, so you might be able to serialize the SVG and upload that, rather than an image. If you need an image version of the graph, then you could employ inkscape or some other vector package to render it for you.
An SVG should be more suitable for storage in a DB anyway, particularly if compressed, as it should be smaller for the same image unless the dataset is enormous.
My only query is why you want to task the browser with generating a graph that you then store on the server; if you just want to render images from graphs, there are a number of programs that will do that for you, including the venerable Graphviz.

Related

Export web application to pdf using server-side render

Our web application(many d3 charts) is set up by vue, and I could export our
webpage to pdf by the combination of canvg, html2canvas(convert web content to
png) and emit png file to server and use nodejs to download it automatically
and periodically(weekly report).
However, I was asked to use different render method from client-side to
server side rendering and use wkhtmltopdf or phantomjs to download pdf.
My question is that is it difficult to render many complicated d3 chart and edit
css in server side rendering by using vue or another technique?
Thanks!
The wkhtmltopdf is a popular library for converting complex html content to pdf.
You don't have to worry about your complicated d3 chart or css. It will handle it. But you have to install wkhtmltopdf command line tool on your system.
SVG DOM elements can be convert into different images format using server side rendering option. Apache Batik such a library to convert SVG DOM elements into pdf,png,jpg,word.
Batik is a Java-based toolkit for applications or applets that want to use images in the Scalable Vector Graphics (SVG) format for various purposes, such as display, generation or manipulation.
The project’s ambition is to give developers a set of core modules that can be used together or individually to support specific SVG solutions. Examples of modules are the SVG Parser, the SVG Generator and the SVG DOM. Another ambition for the Batik project is to make it highly extensible —for example, Batik allows the developer to handle custom SVG elements. Even though the goal of the project is to provide a set of core modules, one of the deliverables is a full fledged SVG browser implementation which validates the various modules and their inter-operability.

Generate Google Charts images using CRON and add to PDF

I want to be able to generate a Google Charts images and this will
done by cron job.
To start with, I understand that Google Charts is a client-side library that runs in browsers, so you can only generate charts in the browser. And also, I'm using a PHP Framework.
Here's where I am right now:
Firstly, I finished creating the PDF. Using MPDF, I was able to
successfully make a daily report in PDF format via cron.
Secondly, I already have generated server-side Google charts as images via the browser, and save those images to a folder. I was able to insert the image of the graph I wanted to
add.
https://developers.google.com/chart/interactive/docs/printing
But what I want is the cron job to generated the chart image. Setting the CRON, I'd like to generate an image of the certain Google Chart.
This is the closest topic I can find that is related to my question, but this thread didn't have an answer: Using Google Charts API Generated Graphic in FPDF

Abap : convert svg to png

I have an svg file and I want to convert it to image png, I am searching any class that do this in ABAP but I could not find any results.
I tried to do this with Javascript then execute it from ABAP but my code in JS should be without DOM implementation or browser functionalities to be able to run it from ABAP.
SVG is - as its name implies - a vector graphics format while PNG is a raster graphics format. Converting vector graphics to raster graphics requires all kinds of "interesting" capabilities that ABAP isn't really suitable for, for instance rendering text in (almost) any font with various attributes and modifiers into a bitmap. I would be surprised if a pure ABAP solution existed at all. It should be possible from a technical point of view, but as you might imagine, it'd be an enormous task.
That being said, you might want to try to use the IMGCONV part of the Internet Graphics Service. I'm not sure whether it support SVG, but you might want to check out the classes CL_IGS_*.
You could try doing this with a GUI attached running windows. If that's an option. The back-end server-side Java interpreter does lack a DOM, yes. But perhaps you can find a library that can do this in Java without a DOM? Should be easier than doing the bit manipulations required in ABAP.
you cannot convert an SVG into a PNG or JPEG in abap.
First of all you have to download the SVG file and open it in Paint, if you use win. Then save it as bitmap in 256 color. After that you can convert it into png files. (why? If you load the file without converting it to 256-color bitmaps, SAP may not interpret the colors well. Withe can became gray and gray can became blu)
Advice: if you want to use the image in smartforms or adobeforms or sapscritp, best way is to upload it in bitmap in se78 transaction and call it in you printouts or alv header

Generating redistributable map images without a server

I want to make an app that allows users to download static images of maps and redistribute them in Anki flashcard decks. However, I'm having a tough time figuring out how to generate the map images without facing any licencing restrictions or running my own server. I want my app to be all client side JavaScript which rules out one of the solutions I've found so far. I've seen a way to use openlayers to export images from the canvas, however a proxy sever is required to convert the canvas to a dataURL so it can be saved.
The most promising option I've found so far is the MapQuest Open Static Maps API. However, I can't find much information about how open it really is. The OSM data is open, but I'm not sure about the images themselves, as they say copyright mapquest on them. Mapbox also has a static map API with licensing restrictions that are unclear to me.
I ended up using leaflet-image. leaflet-image can generate image dataURLs from leafletjs L.map objects using OSM tiles. It uses CORS to request the tiles and avoid tainting the canvas.
Thanks to #tyr for mentioning leaflet-image in his comment. The issues I mentioned in the comments have been resolved.
We developed a solution using TileMill to generate MBTiles files. We then developed a very simple PHP script, which opened the MBTiles (essentially a sqlite db) then saved the blobs for each image out to a file.

Processing Javascript on the server

I'm looking to use this chart generation library: http://www.jqchart.com/
Ideally, I would prefer to use a PHP charting library for the current project I'm working, but, by the looks of it, this is the only library I've found that can handle what I need to do (given a somewhat unconventional requirement for the charts).
The issue is that I need to get the generated graphs as images (at the moment each graph seems to be a combination of images) to the server so that I can generate some PDF documents, etc.
I'm thinking of attempting to create an image using JS, pushing this back to the server and then generating the PDF although this pretty nasty and will probably cause issues between different versions of the browser.
So now what I'm looking for is a solution that will allow me to generate the graphs and turn them into images on the backend.
Any ideas?
EDIT: For the requirement that led me to rule out a number of other charting libraries, see here: Complex charts in Google Charts
That really isn't all that relevant to the question of processing Javascript on the server, though.
You can render a javascript graph on the server using phantomjs. Here is an example.
Not sure what your requirements are, but I'd check out Google Chart Tools: http://code.google.com/apis/chart/. It's really simple to use. All the data is in the image URL get request, so you can generate charts using client-side JavaScript too.

Categories