I am currently develloping a webservice to visualize neo4j graph on a html webpage. I use bolt driver to establish the connection with my database using javascript.
However even if I succeed to install "Apoc" plugin to export data to JSON format it's not d3 ready, furthemore I am not able to parse the data to a d3 format...
If anyone has any idea how I could retrieve a "nicer" format. like
[nodes{},
links{}]
Related
i m working on a project to visualise a network on a php page using D3.js or cytoscape.js
but i don t know how to import data from mysql .
any ideas ? or should i look for an other library ?
It doesn't matter what library you're using. You need to have an HTTP server running that accesses the DB.
If you use Cytoscape, you can just fetch() the results, e.g. cytoscape({ elements: fetch('http://myserver/get-eles') })
I'm trying to generate a Traffic Graph with Highchart from my JSON API.
Can someone help me to create the Javascript to create the graph from a json output like this:
[{"id":"1","upload":"767996","download":"3590994","timestamp":1459858309},{"id":"2","upload":"770635","download":"3594895","timestamp":1459858310},{"id":"3","upload":"796561","download":"3707508","timestamp":1459858337},{"id":"4","upload":"799858","download":"3710316","timestamp":1459858337},{"id":"5","upload":"801162","download":"3712063","timestamp":1459858338},{"id":"6","upload":"803541","download":"3713706","timestamp":1459858338},{"id":"7","upload":"805920","download":"3715373","timestamp":1459858338},{"id":"8","upload":"808421","download":"3716762","timestamp":1459858338},{"id":"9","upload":"809305","download":"3717695","timestamp":1459858338},{"id":"10","upload":"810381","download":"3718856","timestamp":1459858338}]
It's possbile to change the API output if it's needed.
Best regards
Leif
I need to generate decision trees from a MYSQL v 5.6 table, queried with PHP PDO. I have a nice query which gives the data required, however I can't find the correct format to parse data to the Google API.
I searched and found a myriad of articles on how to format data to feed Google Charts. However the common denominator is the use of the infamous and deprecated mysql_query class to fetch data, and some addrow method which I found quite strange and UnClean.
I'm asking how should I format the json output in order to porperly feed the API. At the moment I query the data, json encode it using PHP's json_encode, and get the data properly via AJAX. Indeed my console shows that the data is properly read by the browser, however I know there is a format issue.
Unfortuantely tha google visualization API doesn't give me info on where the error could be. I just received this message:
Invalid format in explicit format: column #0 must be of type 'number'
Well this is a sample of data that the google javascript receives:
[{"id":"1","elemento":"CLIO","parent":"0","size":306}, {"id":"2","elemento":"LOGAN","parent":"0","size":431}, {"id":"3","elemento":"SANDERO","parent":"0","size":335},
On the other way, I'm following strictly the Google visualization guidelines to use data from external data sources:
Populating Data Using Server-Side Code
and specifically the chart that I need to render Wordtrees, which uses and arrayToDataTable method to format properly the data.
What should I correct in order to get and/or read the proper formatted json string of data? Please keep in mind the previous example of actual data which uses:
echo json_encode($data);
to JSON format the query output. Should I construct a table? How to do it in a proper, clean and modern way, not the mysql_query iteration.
Thanks for your time and collaboration.
We have a product like Zillow which has all the Active Properties for Sale. We have a spring boot backend that has JSON Rest API to get those Properties that are on Sale.
Our simple front end calls this JSON API and renders the properties for our HomeBuyers.
The problem is anyone can steal our listings and build their website in minutes from our JSON API. So here is what we would like to do. Instead of JSON we would like to send a HTML to FrontEnd. Our problem is how to go about it in most modern/scalabale efficient way..
Some Options:
1) Don't open our JSON APIs to internet but Write another JAVA Service that fronts the JSON API service and translates them to HTML. So our front end calls upon this new JAVA service and not directly the JSON API service..
2) Node JS App which in Backend talks to JSON API and Converts it to HTML while the front end talks to this Node App.. (Are there any libraries that already do this? Have you ever used them)
Any help/options/opinions you provide are greatly appreciated..
You can "secure" your JSON api with an authentification method like JSON Webtokens. That way, nobody who isn't authenticated can use the JSON api. Use Google's Angular JS to render to your website.
I am a newbie to D3 library. The application utilizes D3 library to plot charts. Some of the changes like button click, zoom happens on the fly without hitting the server.
Is there any way to capture the state,store the state in the database and then re-create the exact visualization??
D3 charts are scalable vector graphics (SVGs).
The current state of any chart can be captured by selecting the SVG using d3 itself. For example can just call :
var allSVGs = d3.selectAll("svg")
This call will select all the svg elements on the page. You can then iterate through them and serialize them to xml like so :
var serializer = new XMLSerializer();
allSVGs.forEach(function(svgElement) {
var svg = d3.select(svgElement).attr("version", 1.1).attr("xmlns",
"http://www.w3.org/2000/svg").node()
xmlString = xmlString + serializer.serializeToString(svg);
You can then POST the xml to your server and do whatever you like with it such as storing it in a database.
To re-create the chart you can read the xml from the database and pass it to the browser as it is. I've been doing this on the server side with phantomjs (a headless web browser) and its been working well.