关系树族谱echarts +php

关系树族谱echarts +php_第1张图片

前台页面


   


             
main" style="height:800px;">

       

注释

result.data数据源查看

110445_TQwm_3255899.png

{"data":[{"name":"\u7528\u62371","value":"23","symbol":"'circle'","children":[{"name":"\u7528\u62371","value":"23","symbol":"'circle'"},{"name":"\u7528\u62372","value":"22","symbol":"'circle'"},{"name":"\u7528\u62373","value":"21","symbol":"'circle'"},{"name":"\u7528\u62374","value":"2","symbol":"'circle'"}]},{"name":"\u7528\u62372","value":"22","symbol":"'circle'"},{"name":"\u7528\u62373","value":"21","symbol":"'circle'","children":[{"name":"\u7528\u62371","value":"23","symbol":"'circle'","children":[{"name":"\u7528\u62371","value":"23","symbol":"'circle'"},{"name":"\u7528\u62372","value":"22","symbol":"'circle'"},{"name":"\u7528\u62373","value":"21","symbol":"'circle'"},{"name":"\u7528\u62374","value":"2","symbol":"'circle'"}]},{"name":"\u7528\u62372","value":"22","symbol":"'circle'"},{"name":"\u7528\u62373","value":"21","symbol":"'circle'"},{"name":"\u7528\u62374","value":"2","symbol":"'circle'"}]},{"name":"\u7528\u62374","value":"2","symbol":"'circle'"}]}

数据库

--
-- 表的结构 `his_zupu`
--

CREATE TABLE IF NOT EXISTS `his_zupu` (
  `symbol` varchar(220) NOT NULL DEFAULT '''image://http://pic.58pic.com/58pic/12/36/51/66d58PICMUV.jpg''',
  `id` smallint(12) NOT NULL AUTO_INCREMENT,
  `name` varchar(12) NOT NULL,
  `value` varchar(12) NOT NULL DEFAULT '2',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;

--
-- 转存表中的数据 `his_zupu`
--

INSERT INTO `his_zupu` (`symbol`, `id`, `name`, `value`) VALUES
('''circle''', 1, '用户1', '23'),
('''circle''', 2, '用户2', '22'),
('''circle''', 3, '用户3', '21'),
('''circle''', 4, '用户4', '2');

 

php后台代码

//族谱数据
    public function display_data() {
            $arr=array();
            //$arr['nodes']=D('nodes')->select();
            $arr['data']=D('zupu')->field('name,value,symbol')->select();
            $arr['data'][0]['children']=$arr['data'];
            $arr['data'][2]['children']=$arr['data'];
            //echo'

';
            //var_dump($arr['data']);
            echo  json_encode($arr);              
    }

 

转载于:https://my.oschina.net/u/3255899/blog/839791

你可能感兴趣的:(关系树族谱echarts +php)