Jump to content

How use jsmind to draw mind picture?


55143681

Recommended Posts

Just now, 55143681 said:

2022-03-02_144528.jpg.a94139234ddaf9859c5642f451c7a297.jpg

I am so glad to tell you that I have call jsmind from my unigui project successfully,

but I want to call the jsmind dynamicly,

How to transfer my own mind data into the html code or javascript?

 

My example is follow:

1、Add js to UniServerModule->CustomFiles:

files/js/jsmind.js
files/js/jsmind.screenshot.js
files/js/jsmind.draggable.js

2、Add css to UniServerModule->CustomCss:

files/style/jsmind.css

3、Add HTML code to UniHTMLFrame->HTML:

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>jsMind</title>
    <link type="text/css" rel="stylesheet" href="../style/jsmind.css" />
    <style type="text/css">
        #jsmind_container{
            width:800px;
            height:500px;
            border:solid 1px #ccc;
            /*background:#f4f4f4;*/
            background:#f4f4f4;
        }
    </style>
</head>
<body>
<div id="jsmind_container"></div>
<script type="text/javascript" src="../js/jsmind.js"></script>
<script type="text/javascript" src="../js/jsmind.draggable.js"></script>
<script type="text/javascript">
    function load_jsmind(){
        var mind = {
            "meta":{
                "name":"demo",
                "author":"hizzgdev@163.com",
                "version":"0.2",
            },
            "format":"node_array",
            "data":[
                {"id":"root", "isroot":true, "topic":"jsMind"},

                {"id":"sub1", "parentid":"root", "topic":"sub1", "background-color":"#0000ff"},
                {"id":"sub11", "parentid":"sub1", "topic":"sub11"},
                {"id":"sub12", "parentid":"sub1", "topic":"sub12"},
                {"id":"sub13", "parentid":"sub1", "topic":"sub13"},

                {"id":"sub2", "parentid":"root", "topic":"sub2"},
                {"id":"sub21", "parentid":"sub2", "topic":"sub21"},
                {"id":"sub22", "parentid":"sub2", "topic":"sub22","foreground-color":"#33ff33"},

                {"id":"sub3", "parentid":"root", "topic":"sub3"},
            ]
        };
        var options = {
            container:'jsmind_container',
            editable:true,
            theme:'primary'
        }
        var jm = jsMind.show(options,mind);
        // jm.set_readonly(true);
        // var mind_data = jm.get_data();
        // alert(mind_data);
        jm.add_node("sub2","sub23", "new node", {"background-color":"red"});
        jm.set_node_color('sub21', 'green', '#ccc');
    }

    load_jsmind();
</script>
</body>
</html>

Link to comment
Share on other sites

26 minutes ago, 55143681 said:

I am so glad to tell you that I have call jsmind from my unigui project successfully,

Hello. Okay, good.

26 minutes ago, 55143681 said:

but I want to call the jsmind dynamicly,

How to transfer my own mind data into the html code or javascript?

I don't know. Need to check...

Link to comment
Share on other sites

19 hours ago, 55143681 said:

Thank you very much,

I just want to use UniDAC to query my data  and transfer my mind data "node_array" into the jsmind to draw my mind picture.

Maybe I have to use  "UniHTMLFrame1->HTML->Add()" to do this.

 

UniHTMLFrame1->HTML->Add("            \"data\":[") ;
UniHTMLFrame1->HTML->Add("                {\"id\":\"root\", \"isroot\":true, \"topic\":\"jsMind\"},") ;

UniHTMLFrame1->HTML->Add("                {\"id\":\"sub1\", \"parentid\":\"root\", \"topic\":\"sub1\", \"background-color\":\"#0000ff\"},") ;
UniHTMLFrame1->HTML->Add("                {\"id\":\"sub11\", \"parentid\":\"sub1\", \"topic\":\"sub11\"},") ;
UniHTMLFrame1->HTML->Add("                {\"id\":\"sub12\", \"parentid\":\"sub1\", \"topic\":\"sub12\"},") ;
UniHTMLFrame1->HTML->Add("                {\"id\":\"sub13\", \"parentid\":\"sub1\", \"topic\":\"sub13\"},") ;

UniHTMLFrame1->HTML->Add("                {\"id\":\"sub2\", \"parentid\":\"root\", \"topic\":\"sub2\"},") ;
UniHTMLFrame1->HTML->Add("                {\"id\":\"sub21\", \"parentid\":\"sub2\", \"topic\":\"sub21\"},") ;
UniHTMLFrame1->HTML->Add("                {\"id\":\"sub22\", \"parentid\":\"sub2\", \"topic\":\"sub22\",\"foreground-color\":\"#33ff33\"},") ;

UniHTMLFrame1->HTML->Add("                {\"id\":\"sub3\", \"parentid\":\"root\", \"topic\":\"sub3\"},") ;
UniHTMLFrame1->HTML->Add("            ]") ;
UniHTMLFrame1->HTML->Add("        };") ;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...