In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to generate a mind map with JavaScript". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to generate a mind map with JavaScript".
First take a look at the contents of example.parse.js:
Var fs = require ('fs'); var parse = require ('.. / parse.markdown'); var transform = require ('.. / transform.headings'); var text = fs.readFileSync ('gtor.md',' utf-8'); var headings = parse (text); var root = transform (headings); console.log (root); fs.writeFileSync ('gtor.json', JSON.stringify (root))
Use nodejs named node example.parse.js to execute this code: the code reads the local file gtor.md that contains the mind map, parses and transforms to generate the local file gtor.json.
Then look at example.view.js and find that the author uses d3 to render UI.
D3.json ("gtor.json", function (error, data) {if (error) throw error; markmap ('svg#mindmap', data, {preset:' default', / / or colorful linkShape: 'diagonal' / / or bracket});})
If you directly double-click the index.html file in the examples folder to open it in the browser, a cross-domain error will occur and the local file gtor.json will not be accessible:
You must deploy this example to run on the server.
Start the server locally with the nodejs command line:
Node local.js
Then localhost:3000/mindmap can see the effect of mind mapping.
Thank you for your reading, the above is the content of "how to use JavaScript to generate mind map". After the study of this article, I believe you have a deeper understanding of how to use JavaScript to generate mind map, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 243
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.