I'm currently looking at the following example https://bl.ocks.org/mbostock/7607999. The json file which the chart is getting its data from is in the following format {"name":"flare.analytics.cluster.MergeEdge","size":743,"imports":[]}];
Instead of the above format, is it possible to have it as
{"imports":[],"name":"flare.analytics.cluster.MergeEdge","size":743};
Many thanks in advance for taking the time to read this.
Basically, D3.js get json data via your obj.name, so that's no matter how your json data sorting, I try a demo modify
{"name":"flare.vis.data.render.ArrowType", "size":698,"imports":[]}
to
{"size":698,"imports":[],"name":"flare.vis.data.render.ArrowType"}
and the graph still show out the same.
Related
Can anyone please suggest how to import '500112' and 'SBIN' from https://www.moneycontrol.com/india/stockpricequote/banks-public-sector/statebankindia/SBI in Google spreadsheet using importData or importXML functions?
Try using
=IMPORTXML(A1,"//ctag[#class='mob-hide']//span") #where A1 is the url
this should get you both.
adding, for example:
=IMPORTXML(A1,"//ctag[#class='mob-hide']//span[1]")
at the end should output just
500112
Edit:
Since the question was asked, the site started using dynamically loaded data which GS can't handle. Using the tools in your browser's Developer tab, you can find out that the target data is loaded from a different site (see below) and that it is in json format.
So you need to use GS's importJSON() function for that:
A1 = https://priceapi.moneycontrol.com/pricefeed/bse/equitycash/SBI
A2 =importJSON(A1)
Make sure there's enough space on the sheet to expand the output. Once you do, you'll find the two target items under the columns Data Bseid and Data Nseid, probably in columns AL and AM.
I've a requirement to persist a flowchart built by users into database. Until now, I've been using BLOBs to store the flowchart image. But I want to serialize the flow chart and persist them as a structured data.
For example, a flow chart will have start and end, process box, input/output box, decision flow etc. All these elements will be connected by arrows. I'm blanking out on how to model data structure that will store this information. Any tips would be appreciated?
Sorry, but this question is too vague.
Perhaps the best question to start off asking yourself:
Q: Do I really want to invent my own format, or find an existing "flowchart"
format that does what I need?
If you want to invent your own, I'd strongly suggest:
Using JSON or XML (instead of something completely ad-hoc), and
Finding JSON or XML examples for storing "graphs" (nodes, edges, etc).
Here is one such example: http://jsongraphformat.info/
But then your next challenge would be how to DISPLAY your flowchat, after you've read it from the database.
ANOTHER SUGGESTION:
Assume, for example, you're using Visio. I'd just store the .vsd in your database!
I'm trying to merge counties from a "us.json" TopoJSON file into their respective agricultural districts. I've followed the "Merging States II" code found here: http://bl.ocks.org/mbostock/5416440 and it works as intended. The only problem is that it takes 10-15 seconds to load in the browser because of all the processing that is going on.
I have to believe there is a more efficient way to do this task; maybe even merging the polygons ahead of time using TopoJSON, but I'm not as familiar with that program so I'm at a loss as to how to proceed.
The html and JSON lookup files can be found at the GitHub Gist below
https://gist.github.com/nautilytics/6719443
Any comments or suggestions are greatly appreciated.
Thanks for the comments. I was able to export the three different shapefile layers from ArcGIS and then toss them into http://mapshaper.org/ to simplify them. Then I used the TopoJSON command line tool to combine them all into a single JSON file. Works amazing.
Final output: http://nautilytics.com/NASS-Corn-Acres-Planted/
I would want to get a structured version of a Wikiquote page via JSON (basically I need all phrases)
Example: http://en.wikiquote.org/wiki/Fight_Club_(film)
I tried with: http://en.wikiquote.org/w/api.php?format=xml&action=parse&page=Fight_Club_(film)&prop=text
but I get all HTML source code. I need each pharse as an element of an Array
How could I achieve that with DBPEDIA?
For one thing Iam not sure whether you can query wiki quotes using DBpedia and secondly, DBpedia gives you only info box data in a structured way, it does not in a any way the article content in a structured way. Instead with a little bit of trouble you can use the Media wiki api to get the data
EDIT
The URI you are trying gives you a text so this will make things easier, but not completely.
Try this piece of code in your console:
require 'Nokogiri'
content = JSON.parse(open("http://en.wikiquote.org/w/api.php?format=json&action=parse&page=Fight_Club_%28film%29&prop=text").read)
data = content['parse']['text']['*']
xpath_data = Nokogiri::HTML data
xpath_data.xpath("//ul/li").map{|data_node| data_node.text}
This is the closest I have come to an answer, of course this is not completely right because you will get a lot on unnecessary data. But if you dig into Nokogiri and xpath and find out how to pin point the nodes you need you can get a solution which will give you correct quotes at least 90% of the time.
Just change the format to JSON. Look up the Wikipedia API for more details.
http://en.wikiquote.org/w/api.php?format=json&action=parse&page=Fight_Club_(film)&prop=text
There is a table in a geoDB with fields in Well-known binary (WKB) data format. I would like to get latitude and longitude from this binary data in normal decimal format independent from DB (with Java for example). Does any library or code example exist for such transformation?
Thanks in advance.
Not sure if you found a solution yet, but I found a free Java library. Info Here and download page Here.
From what I can tell it supports WKB and WKT as well as a few others.
Enjoy!
Select the data from the geometry field using the AsText(Geometry) function. This gives you the geometry object in a textural representations. If you have to draw on a web page use AsSVG(Geometry) and you get the data as SVG