127.0.0.1:9200
URL: http://127.0.0.1:9200/likecs_art_db/_search
REQUEST:
Array
(
    [query] => Array
        (
            [match] => Array
                (
                    [text] => Array
                        (
                            [query] => 使用echarts画一个类似组织结构图的图表
                        )

                )

        )

    [highlight] => Array
        (
            [fields] => Array
                (
                    [text] => stdClass Object
                        (
                        )

                )

            [pre_tags] => #em#
            [post_tags] => #/em#
        )

    [size] => 8
    [from] => 0
)
RESPONSE:
string(7750) "{"took":60,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":10000,"relation":"gte"},"max_score":59.077175,"hits":[{"_index":"likecs_art_db","_type":"_doc","_id":"77381","_score":59.077175,"_source":{"id":"77381","text":"\u4f7f\u7528echarts\u753b\u4e00\u4e2a\u7c7b\u4f3c\u7ec4\u7ec7\u7ed3\u6784\u56fe\u7684\u56fe\u8868","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n    color: [\r\n        ","username":"tnnyang","tagsname":null,"tagsid":"","catesname":null,"catesid":"","createtime":"1639951581"},"highlight":{"text":["#em#使#/em##em#用#/em##em#echarts#/em##em#画#/em##em#一#/em##em#个#/em##em#类#/em##em#似#/em##em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em##em#的#/em##em#图#/em##em#表#/em#"]}},{"_index":"likecs_art_db","_type":"_doc","_id":"448495","_score":36.62895,"_source":{"id":"448495","text":"JavaScript \u753b\u7ec4\u7ec7\u7ed3\u6784\u56fe","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n    color: [\r\n        ","username":"smallsong","tagsname":"","tagsid":"","catesname":null,"catesid":"","createtime":"1639639794"},"highlight":{"text":["JavaScript #em#画#/em##em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em#"]}},{"_index":"likecs_art_db","_type":"_doc","_id":"511677","_score":36.62895,"_source":{"id":"511677","text":"JavaScript \u753b\u7ec4\u7ec7\u7ed3\u6784\u56fe","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n    color: [\r\n        ","username":"smallsong","tagsname":"","tagsid":"","catesname":null,"catesid":"","createtime":"1634533683"},"highlight":{"text":["JavaScript #em#画#/em##em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em#"]}},{"_index":"likecs_art_db","_type":"_doc","_id":"358387","_score":33.20962,"_source":{"id":"358387","text":"\u624b\u628a\u624b\u6559\u4f60\u505aecharts\u56fe\u8868\u7cfb\u5217\u4e4b\u7ec4\u7ec7\u7ed3\u6784\u56fe","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n    color: [\r\n        ","username":"lingluo2017","tagsname":null,"tagsid":"","catesname":"","catesid":"","createtime":"1641123612"},"highlight":{"text":["手把手教你做#em#echarts#/em##em#图#/em##em#表#/em#系列之#em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em#"]}},{"_index":"likecs_art_db","_type":"_doc","_id":"481263","_score":32.740807,"_source":{"id":"481263","text":"\u7ec4\u7ec7\u7ed3\u6784\u56fe","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n    color: [\r\n        ","username":"onceweb","tagsname":"","tagsid":"","catesname":null,"catesid":"","createtime":"1641123619"},"highlight":{"text":["#em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em#"]}},{"_index":"likecs_art_db","_type":"_doc","_id":"426266","_score":31.442493,"_source":{"id":"426266","text":"\u7ec4\u7ec7\u7ed3\u6784\u56fe\u53ef\u4ee5\u7528\u4ec0\u4e48\u8f6f\u4ef6\u753b\uff1f","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n    color: [\r\n        ","username":"jags","tagsname":"","tagsid":"","catesname":"","catesid":"","createtime":"1638418849"},"highlight":{"text":["#em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em#可以#em#用#/em#什么软件#em#画#/em#?"]}},{"_index":"likecs_art_db","_type":"_doc","_id":"358386","_score":31.442493,"_source":{"id":"358386","text":"\u7ec4\u7ec7\u7ed3\u6784\u56fe\u53ef\u4ee5\u7528\u4ec0\u4e48\u8f6f\u4ef6\u753b\uff1f","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n    color: [\r\n        ","username":"jags","tagsname":"","tagsid":"","catesname":"","catesid":"","createtime":"1641123613"},"highlight":{"text":["#em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em#可以#em#用#/em#什么软件#em#画#/em#?"]}},{"_index":"likecs_art_db","_type":"_doc","_id":"481264","_score":31.4341,"_source":{"id":"481264","text":"\u67b6\u6784\u7ec4\u7ec7\u7ed3\u6784\u56fe","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n    color: [\r\n        ","username":"ixiaoyang8","tagsname":null,"tagsid":"","catesname":"","catesid":"","createtime":"1641123618"},"highlight":{"text":["架#em#构#/em##em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em#"]}}]}}"
127.0.0.1:9200
URL: http://127.0.0.1:9200/likecs_art_db/_search
REQUEST:
Array
(
    [query] => Array
        (
            [match] => Array
                (
                    [text] => Array
                        (
                            [query] => 使用echarts画一个类似组织结构图的图表
                        )

                )

        )

    [highlight] => Array
        (
            [fields] => Array
                (
                    [text] => stdClass Object
                        (
                        )

                )

            [pre_tags] => #em#
            [post_tags] => #/em#
        )

    [size] => 8
    [from] => 8
)
RESPONSE:
string(7410) "{"took":65,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":10000,"relation":"gte"},"max_score":59.077175,"hits":[{"_index":"likecs_art_db","_type":"_doc","_id":"430397","_score":31.378149,"_source":{"id":"430397","text":"js-\u7ec4\u7ec7\u7ed3\u6784\u56fe","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n    color: [\r\n        ","username":"fzhome","tagsname":"","tagsid":"","catesname":"","catesid":"","createtime":"1639277446"},"highlight":{"text":["js-#em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em#"]}},{"_index":"likecs_art_db","_type":"_doc","_id":"898043","_score":31.378149,"_source":{"id":"898043","text":"GoJS\u7ec4\u7ec7\u7ed3\u6784\u56fe","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n    color: [\r\n        ","username":"Alwaysbecoding","tagsname":"","tagsid":"","catesname":null,"catesid":"","createtime":"1639639844"},"highlight":{"text":["GoJS#em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em#"]}},{"_index":"likecs_art_db","_type":"_doc","_id":"430405","_score":30.221058,"_source":{"id":"430405","text":"\u7ec4\u7ec7\u7ed3\u6784\u56fe\u6a21\u677f\u5206\u4eab\uff0c\u5728\u7ebf\u7ed8\u5236\u7ec4\u7ec7\u7ed3\u6784\u56fe","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n    color: [\r\n        ","username":"","tagsname":null,"tagsid":"","catesname":null,"catesid":"","createtime":"1635307522"},"highlight":{"text":["#em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em#模板分享,在线绘制#em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em#"]}},{"_index":"likecs_art_db","_type":"_doc","_id":"430391","_score":30.124386,"_source":{"id":"430391","text":"\u7ec4\u7ec7\u7ed3\u6784\u56fe --- \u5546\u52a1","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n    color: [\r\n        ","username":"onelikeone","tagsname":"","tagsid":"","catesname":null,"catesid":"","createtime":"1639639847"},"highlight":{"text":["#em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em# --- 商务"]}},{"_index":"likecs_art_db","_type":"_doc","_id":"358391","_score":30.124386,"_source":{"id":"358391","text":"jquery \u7ec4\u7ec7\u7ed3\u6784\u56fe(orgchart)","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n    color: [\r\n        ","username":"light-zhang","tagsname":"","tagsid":"","catesname":"","catesid":"","createtime":"1639277450"},"highlight":{"text":["jquery #em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em#(orgchart)"]}},{"_index":"likecs_art_db","_type":"_doc","_id":"381903","_score":30.124386,"_source":{"id":"381903","text":"\u7ec4\u7ec7\u7ed3\u6784\u6811\u72b6\u56fe","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n    color: [\r\n        ","username":"peipeiyu","tagsname":"","tagsid":"","catesname":null,"catesid":"","createtime":"1639639846"},"highlight":{"text":["#em#组#/em##em#织#/em##em#结#/em##em#构#/em#树状#em#图#/em#"]}},{"_index":"likecs_art_db","_type":"_doc","_id":"511673","_score":30.124386,"_source":{"id":"511673","text":"\u7ec4\u7ec7\u7ed3\u6784\u6811\u72b6\u56fe","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n    color: [\r\n        ","username":"peipeiyu","tagsname":"","tagsid":"","catesname":null,"catesid":"","createtime":"1634533677"},"highlight":{"text":["#em#组#/em##em#织#/em##em#结#/em##em#构#/em#树状#em#图#/em#"]}},{"_index":"likecs_art_db","_type":"_doc","_id":"976746","_score":30.124386,"_source":{"id":"976746","text":"GoJS\u7ec4\u7ec7\u7ed3\u6784\u56fe2","intro":"\u76ee\u5f55\n\nECharts\n\u5f02\u6b65\u52a0\u8f7d\n\n\n\nECharts\r\n\u6570\u636e\u53ef\u89c6\u5316\u5728\u8fc7\u53bb\u51e0\u5e74\u4e2d\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u5f00\u53d1\u4eba\u5458\u5bf9\u53ef\u89c6\u5316\u4ea7\u54c1\u7684\u671f\u671b\u4e0d\u518d\u662f\u7b80\u5355\u7684\u56fe\u8868\u521b\u5efa\u5de5\u5177\uff0c\u800c\u662f\u5728\u4ea4\u4e92\u3001\u6027\u80fd\u3001\u6570\u636e\u5904\u7406\u7b49\u65b9\u9762\u6709\u66f4\u9ad8\u7684\u8981\u6c42\u3002\r\nchart.setOption({\r\n    color: [\r\n        ","username":"Alwaysbecoding","tagsname":"","tagsid":"","catesname":"","catesid":"","createtime":"1639874150"},"highlight":{"text":["GoJS#em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em#2"]}}]}}"
127.0.0.1:9200
URL: http://192.168.101.128/searchcore/index.php/cihere_cn_db/_search
REQUEST:
Array
(
    [query] => Array
        (
            [match] => Array
                (
                    [title] => Array
                        (
                            [query] => 使用echarts画一个类似组织结构图的图表
                        )

                )

        )

    [highlight] => Array
        (
            [fields] => Array
                (
                    [title] => stdClass Object
                        (
                        )

                )

            [pre_tags] => #em#
            [post_tags] => #/em#
        )

    [from] => 0
)
RESPONSE:
bool(false)
127.0.0.1:9200
URL: http://127.0.0.1:9200/likecs_down_db/_search
REQUEST:
Array
(
    [query] => Array
        (
            [bool] => Array
                (
                    [must] => Array
                        (
                            [0] => Array
                                (
                                    [match] => Array
                                        (
                                            [title] => Array
                                                (
                                                    [query] => 使用echarts画一个类似组织结构图的图表
                                                )

                                        )

                                )

                        )

                    [must_not] => Array
                        (
                            [0] => Array
                                (
                                    [term] => Array
                                        (
                                            [cate1] => 电子书籍
                                        )

                                )

                        )

                )

        )

    [highlight] => Array
        (
            [fields] => Array
                (
                    [title] => stdClass Object
                        (
                        )

                )

            [pre_tags] => #em#
            [post_tags] => #/em#
        )

    [size] => 5
    [from] => 0
)
RESPONSE:
string(2964) "{"took":13,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":10000,"relation":"gte"},"max_score":36.60089,"hits":[{"_index":"likecs_down_db","_type":"_doc","_id":"60224","_score":36.60089,"_source":{"id":"60224","title":"\u7528JavaScript\u5b9e\u73b0\u7684\u5458\u5de5\u7ec4\u7ec7\u7ed3\u6784\u56fe","spidertime":"1623067922","contenttime":"1624740037","pageimage":"https:\/\/img.jbzj.com\/do\/uploads\/userup\/1003\/19195A1GI.gif","tag":"javascript|\u5458\u5de5\u7ec4\u7ec7|\u7ed3\u6784\u56fe","cate1":"js\u6846\u67b6","cate2":"ajax\/javascript","attr1":"8KB"},"highlight":{"title":["#em#用#/em#JavaScript实现#em#的#/em#员工#em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em#"]}},{"_index":"likecs_down_db","_type":"_doc","_id":"60223","_score":31.485102,"_source":{"id":"60223","title":"jQuery OrgChart \u7ed8\u5236\u7ec4\u7ec7\u7ed3\u6784\u56fe\u63d2\u4ef6","spidertime":"1623067918","contenttime":"1678765861","pageimage":"https:\/\/img.jbzj.com\/do\/uploads\/120511\/_115301F1.gif","tag":"|OrgChart|jquery","cate1":"js\u6846\u67b6","cate2":"jQuery","attr1":"28KB"},"highlight":{"title":["jQuery OrgChart 绘制#em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em#插件"]}},{"_index":"likecs_down_db","_type":"_doc","_id":"52445","_score":27.30572,"_source":{"id":"52445","title":"jQuery\u5b9e\u73b0\u7684\u9f20\u6807\u62d6\u62fd\u7ec4\u7ec7\u7ed3\u6784\u56fe\u7279\u6548\u6e90\u7801","spidertime":"1623057052","contenttime":"1624515326","pageimage":"https:\/\/img.jbzj.com\/do\/uploads\/litimg\/160127\/1I50R31220.jpg","tag":"jquery|\u9f20\u6807\u62d6\u62fd|\u7ec4\u7ec7|\u7ed3\u6784\u56fe","cate1":"js\u6846\u67b6","cate2":"jQuery","attr1":"103KB"},"highlight":{"title":["jQuery实现#em#的#/em#鼠标拖拽#em#组#/em##em#织#/em##em#结#/em##em#构#/em##em#图#/em#特效源码"]}},{"_index":"likecs_down_db","_type":"_doc","_id":"69009","_score":26.317587,"_source":{"id":"69009","title":"ECharts JavaScript\u56fe\u8868\u5e93 v5.1.1","spidertime":"1623080643","contenttime":"1625007205","pageimage":"https:\/\/img.jbzj.com\/do\/uploads\/litimg\/200901\/1H40Q05K9.gif","tag":"\u56fe\u8868\u5e93|javascript|ECharts\u4e0b\u8f7d","cate1":"\u6e90\u7801\u4e0b\u8f7d","cate2":"\u8f6f\u4ef6\u5f00\u53d1","cate3":"java\u6e90\u7801","attr1":"7.8MB"},"highlight":{"title":["#em#ECharts#/em# JavaScript#em#图#/em##em#表#/em#库 v5.1.1"]}},{"_index":"likecs_down_db","_type":"_doc","_id":"10545","_score":26.317587,"_source":{"id":"10545","title":"ECharts JavaScript\u56fe\u8868\u5e93 v5.1.1","spidertime":"1622877675","contenttime":"1622877675","pageimage":"https:\/\/img.jbzj.com\/do\/uploads\/litimg\/200901\/1H40Q05K9.gif","tag":"\u56fe\u8868\u5e93|javascript|ECharts\u4e0b\u8f7d","cate1":"\u6e90\u7801\u4e0b\u8f7d","cate2":"\u8f6f\u4ef6\u5f00\u53d1","cate3":"java\u6e90\u7801","attr1":"7.8MB"},"highlight":{"title":["#em#ECharts#/em# JavaScript#em#图#/em##em#表#/em#库 v5.1.1"]}}]}}"
使用echarts画一个类似组织结构图的图表 - 爱码网
tnnyang

昨天,写了一篇关于圆环进度条的博客(请移步:Vue/React圆环进度条),已经烦不胜烦,今天又遇到了需要展示类似公司的组织结构图的功能需求,要冒了!!!

这种需求,自己用div+css也是可以实现的,但是没有什么动画效果,我的css3又很差劲,而且项目中已经使用到了折线图、饼状图、柱状图之类的图表,用的还是百度的echarts,所以这个组织结构图之类的需求也就用了百度的echarts来实现了。

以前用echarts写折线图、柱状图、饼状图的较多,它的API还算比较熟悉,但是画组织结构这样的树状图就很苦逼了,没用过啊,而且设计给的树状图的展示效果跟echarts树状图的展示效果相去甚远,我滴孩,又得一通费时费力的研究,设计图如下:

如图所示,一个树节点中可能会有两种不同的背景色,还有两种不同的文字颜色,每个节点展示的还是圆角矩形。有同学说了,echarts有设置圆角的API啊,直接设置不就完事了。我想说的是,它是提供的有这样的API,但是按照正常的套路实现不了啊。

从图上还可以看到一个几乎实现不了的效果,就是连接每个节点之间的线的拐角处都是直角而不是平滑的,而且echarts没有给出可以设置拐角处是直角的API,只是给了一个curveness(API的描述是树图边的曲度),这玩意儿使用了之后,也还是实现不了的。

从网上查了资料,有人说可以修改echarts的源码,这种解决办法我不推荐,是因为在vue或react项目中,echarts是需要通过安装在package.json中的,如果是多人并行开发,那么别人安装的echarts就不是你修改后的echarts,这就是问题所在。

最后用echarts画出来的效果还是很不错的,唯一没有实现的就是连接每个节点的线的拐角处不是直角,有好的解决办法的,还望不吝赐教,谢谢!展示一下最终的成果:

说了那么多,还是上代码吧,该代码是基于vue的,如果要使用在react中,稍微修改一下就可以了。

组件tree.vue:

<template>
  <div :class="className" :style="{height:height,width:width}" />
</template>

<script>
import echarts from "echarts";
require("echarts/theme/macarons");
import { debounce } from "@/utils";

export default {
  props: {
    className: {
      type: String,
      default: "chart"
    },
    width: {
      type: String,
      default: "100%"
    },
    height: {
      type: String,
      default: "500px"
    },
    chartData: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      chart: null,
    };
  },
  watch: {
    chartData: {
      deep: true,
      handler(val) {
        this.setOptions(val);
      }
    }
  },
  mounted() {
    this.initChart();
    //是否需要自适应-加了防抖函数
    this.__resizeHandler = debounce(() => {
      if (this.chart) {
        this.chart.resize();
      }
    }, 100);
    window.addEventListener("resize", this.__resizeHandler);

    // 监听侧边栏的变化以实现自适应缩放
    const sidebarElm = document.getElementsByClassName("sidebar-container")[0];
    sidebarElm.addEventListener("transitionend", this.sidebarResizeHandler);
  },
  beforeDestroy() {
    if (!this.chart) {
      return;
    }
    window.removeEventListener("resize", this.__resizeHandler);
    this.chart.dispose();
    this.chart = null;

    const sidebarElm = document.getElementsByClassName("sidebar-container")[0];
    sidebarElm.removeEventListener("transitionend", this.sidebarResizeHandler);
  },
  methods: {
    initChart() {
      this.chart = echarts.init(this.$el, "macarons");
      this.setOptions(this.chartData);
    
      const nodes = this.chart._chartsViews[0]._data._graphicEls;
      let allNode = 0;
      for(let index = 0; index < nodes.length; index++) {
        const node = nodes[index];
        if (node === undefined) {
          continue
        }
        allNode++;
      }
      
      const height = window.innerHeight;
      const width = window.innerWidth - 1000;
      const currentHeight = 85 * allNode;
      const currentWidth = 220 * allNode;
      const newHeight = Math.max(currentHeight, height);
      const newWidth = Math.max(currentWidth, width);
      const tree_ele = this.$el;
      // tree_ele.style.height = newHeight + \'px\';  //设置高度自适应
      tree_ele.style.width = newWidth + \'px\';   //设置宽度自适应
      this.chart.resize();

      this.chart.on(\'click\', this.chartData.clickCallback);   //节点点击事件
    },
    setOptions(data) {
      this.chart.setOption({
        //提供数据视图、还原、下载的工具
        // toolbox: {
        //   show : true,
        //   feature : {
        //     mark : {show: true},
        //     dataView : {show: true, readOnly: false},
        //     restore : {show: true},
        //     saveAsImage : {show: true}
        //   }
        // },
        series: [
          {
            name: "统一授信视图",
            type: "tree",
            orient: "TB", //竖向或水平   TB代表竖向  LR代表水平
            top: \'10%\',
            initialTreeDepth: 10,  //树图初始展开的层级(深度)
            expandAndCollapse: false,   //点击节点时不收起子节点,default: true
            symbolSize: [135, 65],
            itemStyle: {
              color: \'transparent\',
              borderWidth: 0,
            },
            lineStyle: {
              color: \'#D5D5D5\',
              width: 1,
              curveness: 1,
            },
            data: [data]
          }
        ]
      });
    },
    sidebarResizeHandler(e) {
      if (e.propertyName === "width") {
        this.__resizeHandler();
      }
    }
  }
};
</script>

使用tree.vue的方法:

<template>
    <tree :chartData="treeData" />
</template>

<script>
import tree from \'./tree\';

export default {
  data() {
    return {
      treeData: {
        label: {
          backgroundColor: \'#F4F4F4\',
          borderRadius: [0, 0, 5, 5],
          formatter: [
            \'{first|综合授信额度}\',
            \'{second|(CR20190912000013)\n获批金额:100\n币种:人民币}\',
          ].join(\'\n\'),
          rich: {
            first: {
              backgroundColor: \'#078E34\',
              color: \'#fff\',
              align: \'center\',
              width: 135,
              height: 30,
              borderRadius: [5, 5, 0, 0],
            },
            second: {
              color: \'#888\',
              align: \'center\',
              lineHeight: 17,
            },
          }
        },
        children: [
          {
            label: {
              formatter: [
                \'{first|渠道额度}\',
              ].join(\'\n\'),
              rich: {
                first: {
                  backgroundColor: \'#3AC082\',
                  color: \'#fff\',
                  align: \'center\',
                  width: 135,
                  height: 65,
                  borderRadius: 5,
                },
              }
            },
            children: [{
              label: {
                formatter: [
                  \'{first|保理额度}\',
                ].join(\'\n\'),
                rich: {
                  first: {
                    backgroundColor: \'#3AC082\',
                    color: \'#fff\',
                    align: \'center\',
                    width: 135,
                    height: 65,
                    borderRadius: 5,
                  },
                }
              },
              children: [{
                label: {
                  backgroundColor: \'#F4F4F4\',
                  borderRadius: [0, 0, 5, 5],
                  formatter: [
                    \'{first|反向保理}\',
                    \'{second|(CR20190912000013)\n获批金额:100\n币种:人民币}\',
                  ].join(\'\n\'),
                  rich: {
                    first: {
                      backgroundColor: \'#078E34\',
                      color: \'#fff\',
                      align: \'center\',
                      width: 135,
                      height: 30,
                      borderRadius: [5, 5, 0, 0],
                    },
                    second: {
                      color: \'#888\',
                      align: \'center\',
                      lineHeight: 17,
                    },
                  }
                },
              }]
            }]
          },
          {
            label: {
              formatter: [
                \'{first|担保/(乐)集团/其他额度}\',
              ].join(\'\n\'),
              rich: {
                first: {
                  backgroundColor: \'#3AC082\',
                  color: \'#fff\',
                  align: \'center\',
                  width: 135,
                  height: 65,
                  borderRadius: 5,
                },
              }
            },
            children: [{
              label: {
                formatter: [
                  \'{first|保理额度}\',
                ].join(\'\n\'),
                rich: {
                  first: {
                    backgroundColor: \'#3AC082\',
                    color: \'#fff\',
                    align: \'center\',
                    width: 135,
                    height: 65,
                    borderRadius: 5,
                  },
                }
              },
              children: [{
                label: {
                  backgroundColor: \'#F4F4F4\',
                  borderRadius: [0, 0, 5, 5],
                  formatter: [
                    \'{first|正向保理}\',
                    \'{second|(CR20190912000013)\n获批金额:100\n币种:人民币}\',
                  ].join(\'\n\'),
                  rich: {
                    first: {
                      backgroundColor: \'#B8D87E\',
                      color: \'#fff\',
                      align: \'center\',
                      width: 135,
                      height: 30,
                      borderRadius: [5, 5, 0, 0],
                    },
                    second: {
                      color: \'#888\',
                      align: \'center\',
                      lineHeight: 17,
                    },
                  }
                },
              }]
            },
            {
              label: {
                formatter: [
                  \'{first|租赁额度}\',
                ].join(\'\n\'),
                rich: {
                  first: {
                    backgroundColor: \'#3AC082\',
                    color: \'#fff\',
                    align: \'center\',
                    width: 135,
                    height: 65,
                    borderRadius: 5,
                  },
                }
              },
              children: [
                {
                  label: {
                    backgroundColor: \'#F4F4F4\',
                    borderRadius: [0, 0, 5, 5],
                    formatter: [
                      \'{first|车辆租赁}\',
                      \'{second|(CR20190912000013)\n获批金额:100\n币种:人民币}\',
                    ].join(\'\n\'),
                    rich: {
                      first: {
                        backgroundColor: \'#FF6C6A\',
                        color: \'#fff\',
                        align: \'center\',
                        width: 135,
                        height: 30,
                        borderRadius: [5, 5, 0, 0],
                      },
                      second: {
                        color: \'#888\',
                        align: \'center\',
                        lineHeight: 17,
                      },
                    }
                  },
                },
              ]
            }]
          }
        ]
      }
    }
  },
  components: {
    tree,
  }
};
</script>

看着代码不多,但是实现起来,各种查echarts的API和网上的资料,而且,由于效果图中一个节点处的文字可能会换行,文字的颜色也不同,同时有些节点处的背景色还会有两种,以及每个节点处显示的样式和文字都是不固定的,所以我们可能还要面临着将接口返回的数据再改造处理成我们想要的数据的繁琐问题,就如同传递给树节点的treeData的格式一样,相当麻烦,如果每个节点的样式都是一样的,那就好办多了,如官网的一个树状图的例子:https://www.echartsjs.com/examples/zh/editor.html?c=tree-vertical

以下更新于2021年1月18日:
从echarts的v4.7.0版本开始,给配置项series中加入一个API:edgeShape:\'polyline\'可实现树形图表连接每个节点的线的拐角处呈直角。

分类:

技术点:

相关文章:

  • 2021-12-12
  • 2021-12-16
  • 2021-10-27
  • 2021-12-16
  • 2021-12-12
  • 2021-12-16
  • 2021-12-19
猜你喜欢
  • 2021-12-16
  • 2022-01-02
  • 2022-01-02
  • 2021-12-02
  • 2022-01-02
相关资源
相似解决方案