【实例简介】增加对jsmind实例修改扩展

【实例截图】

【核心代码】

jsMind

li{margin-top:2px; margin-bottom:2px;}

button{width:140px;}

select{width:140px;}

#layout{width:1230px;}

#jsmind_nav{width:210px;height:600px;border:solid 1px #ccc;overflow:auto;float:left;}

.file_input{width:100px;}

button.sub{width:100px;}

#jsmind_container{

float:left;

width:1000px;

height:600px;

border:solid 1px #ccc;

background:#f4f4f4;

}

1. Open
  1. open example
  2. open remote
  3. open local file
  4. save local file
  5. screenshot
2. Select & Toggle
  1. select a node
  2. try click a node
  3. get the selected
3. Edit
  1. disable editable
  2. add a node
  3. add a image node
  4. modify node
  5. try double click
  6. move a node
  7. move to first
  8. move to last
  9. remove node
4. Style
  1. change font
  2. change color
  3. change bg-color
  4. change background
5. Theme
  1. default

    primary

    warning

    danger

    success

    info

    greensea

    nephrite

    belizehole

    wisteria

    asphalt

    orange

    pumpkin

    pomegranate

    clouds

    asbestos

6. Adjusting
  1. resize container

    adusting

  2. expand/collapse
    1. expand node
    2. collapse node
    3. toggle node
    4. expand to level 2
    5. expand to level 3
    6. expand all
    7. collapse all
  3. zoom

In

Out

7. Multi Format
  1. node_tree(default)

    1. show data
    2. save file
    3. open file
  2. node_array
    1. show data
    2. save file
    3. open file
  3. freemind(.mm)
    1. show data
    2. save file
    3. open file

var _jm = null;

function open_empty(){

var options = {

container:'jsmind_container',

theme:'greensea',

editable:true

}

_jm = jsMind.show(options);

// _jm = jsMind.show(options,mind);

}

function open_json(){

var mind = {

"meta":{

"name":"jsMind remote",

"author":"hizzgdev@163.com",

"version":"0.2"

},

"format":"node_tree",

"data":{"id":"root","topic":"jsMind","children":[

{"id":"easy","topic":"Easy","direction":"left","children":[

{"id":"easy1","topic":"Easy to show"},

{"id":"easy2","topic":"Easy to edit"},

{"id":"easy3","topic":"Easy to store"},

{"id":"easy4","topic":"Easy to embed"},

{"id":"other3","background-image":"ant.png", "width": "100", "height": "100"}

]},

{"id":"open","topic":"Open Source","direction":"right","children":[

{"id":"open1","topic":"on GitHub", "background-color":"#eee", "foreground-color":"blue"},

{"id":"open2","topic":"BSD License"}

]},

{"id":"powerful","topic":"Powerful","direction":"right","children":[

{"id":"powerful1","topic":"Base on Javascript"},

{"id":"powerful2","topic":"Base on HTML5"},

{"id":"powerful3","topic":"Depends on you"}

]},

{"id":"other","topic":"test node","direction":"left","children":[

{"id":"other1","topic":"I'm from local variable"},

{"id":"other2","topic":"I can do everything"}

]}

]}

}

_jm.show(mind);

}

function open_ajax(){

var mind_url = 'data_example.json';

jsMind.util.ajax.get(mind_url,function(mind){

_jm.show(mind);

});

}

function screen_shot(){

_jm.screenshot.shootDownload();

}

function show_data(){

var mind_data = _jm.get_data();

var mind_string = jsMind.util.json.json2string(mind_data);

prompt_info(mind_string);

}

function save_file(){

var mind_data = _jm.get_data();

var mind_name = mind_data.meta.name;

var mind_str = jsMind.util.json.json2string(mind_data);

jsMind.util.file.save(mind_str,'text/jsmind',mind_name '.jm');

}

function open_file(){

var file_input = document.getElementById('file_input');

var files = file_input.files;

if(files.length > 0){

var file_data = files[0];

jsMind.util.file.read(file_data,function(jsmind_data, jsmind_name){

var mind = jsMind.util.json.string2json(jsmind_data);

if(!!mind){

_jm.show(mind);

}else{

prompt_info('can not open this file as mindmap');

}

});

}else{

prompt_info('please choose a file first')

}

}

function select_node(){

var nodeid = 'other';

_jm.select_node(nodeid);

}

function show_selected(){

var selected_node = _jm.get_selected_node();

if(!!selected_node){

prompt_info(selected_node.topic);

}else{

prompt_info('nothing');

}

}

function get_selected_nodeid(){

var selected_node = _jm.get_selected_node();

if(!!selected_node){

return selected_node.id;

}else{

return null;

}

}

function add_node(){

var selected_node = _jm.get_selected_node(); // as parent of new node

if(!selected_node){prompt_info('please select a node first.');return;}

var nodeid = jsMind.util.uuid.newid();

var topic = '* Node_' nodeid.substr(0,5) ' *';

var node = _jm.add_node(selected_node, nodeid, topic);

}

var imageChooser = document.getElementById('image-chooser');

imageChooser.addEventListener('change', function (event) {

// Read file here.

var reader = new FileReader();

reader.onloadend = (function () {

var selected_node = _jm.get_selected_node();

var nodeid = jsMind.util.uuid.newid();

var topic = undefined;

var data = {

"background-image": reader.result,

"width": "100",

"height": "100"};

var node = _jm.add_node(selected_node, nodeid, topic, data);

//var node = _jm.add_image_node(selected_node, nodeid, reader.result, 100, 100);

//add_image_node:function(parent_node, nodeid, image, width, height, data, idx, direction, expanded){

});

var file = imageChooser.files[0];

if (file) {

reader.readAsDataURL(file);

};

}, false);

function add_image_node(){

var selected_node = _jm.get_selected_node(); // as parent of new node

if(!selected_node){

prompt_info('please select a node first.');

return;

}

imageChooser.focus();

imageChooser.click();

}

function modify_node(){

var selected_id = get_selected_nodeid();

if(!selected_id){prompt_info('please select a node first.');return;}

// modify the topic

_jm.update_node(selected_id, '--- modified ---');

}

function move_to_first(){

var selected_id = get_selected_nodeid();

if(!selected_id){prompt_info('please select a node first.');return;}

_jm.move_node(selected_id,'_first_');

}

function move_to_last(){

var selected_id = get_selected_nodeid();

if(!selected_id){prompt_info('please select a node first.');return;}

_jm.move_node(selected_id,'_last_');

}

function move_node(){

// move a node before another

_jm.move_node('other','open');

}

function remove_node(){

var selected_id = get_selected_nodeid();

if(!selected_id){prompt_info('please select a node first.');return;}

_jm.remove_node(selected_id);

}

function change_text_font(){

var selected_id = get_selected_nodeid();

if(!selected_id){prompt_info('please select a node first.');return;}

_jm.set_node_font_style(selected_id, 28);

}

function change_text_color(){

var selected_id = get_selected_nodeid();

if(!selected_id){prompt_info('please select a node first.');return;}

_jm.set_node_color(selected_id, null, '#000');

}

function change_background_color(){

var selected_id = get_selected_nodeid();

if(!selected_id){prompt_info('please select a node first.');return;}

_jm.set_node_color(selected_id, '#eee', null);

}

function change_background_image(){

var selected_id = get_selected_nodeid();

if(!selected_id){prompt_info('please select a node first.');return;}

_jm.set_node_background_image(selected_id, 'ant.png', 100, 100);

}

function set_theme(theme_name){

_jm.set_theme(theme_name);

}

var zoomInButton = document.getElementById("zoom-in-button");

var zoomOutButton = document.getElementById("zoom-out-button");

function zoomIn() {

if (_jm.view.zoomIn()) {

zoomOutButton.disabled = false;

} else {

zoomInButton.disabled = true;

};

};

function zoomOut() {

if (_jm.view.zoomOut()) {

zoomInButton.disabled = false;

} else {

zoomOutButton.disabled = true;

};

};

function toggle_editable(btn){

var editable = _jm.get_editable();

if(editable){

_jm.disable_edit();

btn.innerHTML = 'enable editable';

}else{

_jm.enable_edit();

btn.innerHTML = 'disable editable';

}

}

// this method change size of container, perpare for adjusting jsmind

function change_container(){

var c = document.getElementById('jsmind_container');

c.style.width = '800px';

c.style.height = '500px';

}

function resize_jsmind(){

_jm.resize();

}

function expand(){

var selected_id = get_selected_nodeid();

if(!selected_id){prompt_info('please select a node first.');return;}

_jm.expand_node(selected_id);

}

function collapse(){

var selected_id = get_selected_nodeid();

if(!selected_id){prompt_info('please select a node first.');return;}

_jm.collapse_node(selected_id);

}

function toggle(){

var selected_id = get_selected_nodeid();

if(!selected_id){prompt_info('please select a node first.');return;}

_jm.toggle_node(selected_id);

}

function expand_all(){

_jm.expand_all();

}

function expand_to_level2(){

_jm.expand_to_depth(2);

}

function expand_to_level3(){

_jm.expand_to_depth(3);

}

function collapse_all(){

_jm.collapse_all();

}

function get_nodearray_data(){

var mind_data = _jm.get_data('node_array');

var mind_string = jsMind.util.json.json2string(mind_data);

prompt_info(mind_string);

}

function save_nodearray_file(){

var mind_data = _jm.get_data('node_array');

var mind_name = mind_data.meta.name;

var mind_str = jsMind.util.json.json2string(mind_data);

jsMind.util.file.save(mind_str,'text/jsmind',mind_name '.jm');

}

function open_nodearray(){

var file_input = document.getElementById('file_input_nodearray');

var files = file_input.files;

if(files.length > 0){

var file_data = files[0];

jsMind.util.file.read(file_data,function(jsmind_data, jsmind_name){

var mind = jsMind.util.json.string2json(jsmind_data);

if(!!mind){

_jm.show(mind);

}else{

prompt_info('can not open this file as mindmap');

}

});

}else{

prompt_info('please choose a file first')

}

}

function get_freemind_data(){

var mind_data = _jm.get_data('freemind');

var mind_string = jsMind.util.json.json2string(mind_data);

alert(mind_string);

}

function save_freemind_file(){

var mind_data = _jm.get_data('freemind');

var mind_name = mind_data.meta.name || 'freemind';

var mind_str = mind_data.data;

jsMind.util.file.save(mind_str,'text/xml',mind_name '.mm');

}

function open_freemind(){

var file_input = document.getElementById('file_input_freemind');

var files = file_input.files;

if(files.length > 0){

var file_data = files[0];

jsMind.util.file.read(file_data, function(freemind_data, freemind_name){

if(freemind_data){

var mind_name = freemind_name;

if(/.*\.mm$/.test(mind_name)){

mind_name = freemind_name.substring(0,freemind_name.length-3);

}

var mind = {

"meta":{

"name":mind_name,

"author":"hizzgdev@163.com",

"version":"1.0.1"

},

"format":"freemind",

"data":freemind_data

};

_jm.show(mind);

}else{

prompt_info('can not open this file as mindmap');

}

});

}else{

prompt_info('please choose a file first')

}

}

function prompt_info(msg){

alert(msg);

}

open_empty();

jsmind 线条_jsmind实例扩展(思维导图)相关推荐

  1. 第五周 思维导图与快速学习

    1.思维导图简介 什么是思维导图? 思维导图, 一种能够快速提高办公效率的办公工具,各种思维导图,流程图,组织图,结构图都能轻松制作,在各工作领域为大家带来了很大的方便. 思维导图的功能: 2.思维导 ...

  2. 思维导图(二):绘制规则

    思维导图有其自身的规则和技巧,对于初学者来说,掌握这些规则和技巧是非常必要的.只有在理解并熟练掌握这些技巧之后,绘图者才可以根据自己的意愿去发展属于自己的思维导图技巧和规则. 关键词使用规则 规则 1 ...

  3. 类似echarts图的思维导图效果,用js实现xmind思维导图的效果===使用jsMind来实现

    首先:我先先来看看实现的效果: 然后我再说说具体实现的步骤吧:(别急文件后面我会把百度网盘链接发出来的,除了小案例外还有jsMind的文件,案例,目前的说明文档) 第一:引入jsMind的css.js ...

  4. 在vue中使用jsmind生成思维导图

    在vue中使用jsmind生成思维导图 前景: 项目中有涉及到多层级的数据结构,思维导图的方式更方便查看数据的关系 技术实现:jsmind 实现效果: 安装 npm i jsmind 代码 <t ...

  5. 如何设置XMind思维导图线条

    2019独角兽企业重金招聘Python工程师标准>>> XMind的美化功能超出你的想象,不经意间发现一些新奇的设置能够让你的导图妙趣横生.与众不同.这些功能大部分呢存在于XMind ...

  6. Xmind思维导图编写测试点,便于扩展测试用例(详细)

    什么是思维导图呢? 思维导图(The Mind Map),又名心智导图,是表达发散性思维的有效图形思维工具 ,它简单却又很有效同时又很高效,是一种实用性的思维工具. 什么又是测试点呢? 我们写用例的时 ...

  7. 设计模式—原型模式及其扩展(思维导图)

    建议将思维导图保存下来观看,或点击这里在线观看

  8. 思维导图——快速掌握子网划分(实例详解)

    目录 一.子网划分的作用 二.IP地址的组成 三.IPV4地址 四.IP地址的分类 五.如何计算网络号 六.地址规划 6.1子网数概念 6.2求地址网络可分为几段 6.3CIDR:把若干网络合并成一个 ...

  9. 《麦肯锡方法》第4章 扩展客户-思维导图

    文章目录 第二部分 麦肯锡解决问题的方法 如何做到功夫在诗外 在合适的时间出现,确保合适的人知道你的存在 麦肯锡如何推销 谨慎承诺:严格规划项目 量力而行,树立明确和可到达的目的地 在紧锣密鼓地开始寻 ...

  10. Python数据分析(全) #超长预警 #思维导图 #matplotlib #numpy #pandas

    数据分析 一.基础概念及环境 1. 数据分析概念 2. anaconda 2.3 安装 2.2 基本操作 二.matplotlib 1. 简介 2. 基本要点 3. 使用方法 3.1 最简单形式 3. ...

最新文章

  1. 【java】浅谈注释
  2. Python爬虫入门(2):爬虫基础了解
  3. 灵感编程:最大公约数算法解析
  4. java显示长度和第一个字符_从Java字符串中以长度1的字符串返回的第一个字母的最佳方法是什么?...
  5. Quartz 定时任务(Scheduler)的 3 种实现方式
  6. python画鱼_Python经典五人分鱼实例讲解
  7. c语言简答程序源代码,C语言简答题答案
  8. 同一路由带参刷新,以及params和query两种方式传参的异同
  9. 为什么找不到解决方案?--答案就是:转个弯 这里以“解决表示图左边缺失线条、边缘线、分割线问题”为例...
  10. window下开启mysql慢查询和分割慢查询日志
  11. 基于战舰V3的NRF24L01模块的原理剖析及应用
  12. 【信号处理】单通道盲源分离(SSA-ICA)算法
  13. 基于Qt软件框架设计
  14. 解决navicat闪退
  15. leetcode---栈
  16. 塞班微信登录显示服务器繁忙,塞班系统彻底告别 已无法登陆QQ/微信
  17. SkeyePlayer源码解析系列之支持H265
  18. Smartbi电子表格版功能概览
  19. 程序员都是这样关机的
  20. unity实现鼠标打飞碟(Hit UFO)游戏

热门文章

  1. 2020-02-21
  2. 新会计准则(New Edition of Accounting Standard)
  3. 通达信 移动平均算法_通达信公式教程,建议收藏,关注「所有文章只发表一次」...
  4. 通达OA11.0 补丁文件
  5. 互联网晚报 |10/13 | 腾讯地图PC端将停止服务;国际货币基金组织下调全球经济增长预期至2.7%;保时捷菜刀售价1700元...
  6. markdown 在线解析 工具
  7. 配置安装跟踪服务器Tracker 配置FastDFS存储服务器 Storage
  8. 电子烟行业的十大进销存软件app,强推第一个
  9. CSDN会员服务协议
  10. 2021苏州大学计算机考研分数,2021苏州大学考研分数线已公布