Changeset 2289894
- Timestamp:
- 04/23/2020 07:58:36 AM (6 years ago)
- Location:
- maxicharts-d3js-add-on/trunk
- Files:
-
- 3 edited
-
js/dndTree.js (modified) (6 diffs)
-
js/maxicharts-d3js-frontend.js (modified) (1 diff)
-
maxicharts-d3js.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
maxicharts-d3js-add-on/trunk/js/dndTree.js
r2259662 r2289894 27 27 28 28 29 function processTreeList(root_input, width, height, containerName ) {30 const sample = treeList(width, height );29 function processTreeList(root_input, width, height, containerName, atts = null) { 30 const sample = treeList(width, height; atts); 31 31 d3.select(containerName).datum(root_input).call(sample); 32 32 //d3.select(containerName).attr() … … 39 39 } 40 40 41 function treeList(width, max_height ) {41 function treeList(width, max_height, atts) { 42 42 let margin = {top: 30, right: 20, bottom: 30, left: 30}; 43 43 //let width = 1000; … … 131 131 .duration(200) 132 132 .style("opacity", .9); 133 div .html("<b>Source originale:</b> "+d.data.id + "<br/><b>Accès lecture/écriture:</b> "+d.data.data[ 'Accès restreint'] + "<br/><b>Remarques:</b> " + d.data.data['Remarques'])133 div .html("<b>Source originale:</b> "+d.data.id + "<br/><b>Accès lecture/écriture:</b> "+d.data.data[atts.more_infos_1_col] + "<br/><b>Remarques:</b> " + d.data.data[atts.more_infos_2_col]) 134 134 .style("left", (d3.event.pageX + 200) + "px") 135 135 .style("top", (d3.event.pageY - 28) + "px"); … … 1049 1049 var MaxiChartsCollapsibleTree = class { 1050 1050 1051 constructor(url_of_input_file, jsonStrObject, width, height, containerName, csv_child_col_name = null, csv_parent_col_name = null,csv_description_col_name= null) {1051 constructor(url_of_input_file, jsonStrObject, width, height, containerName, maxicharts_d3js_ajax_shortcode_param = null) { 1052 1052 console.log("Building collapsible tree with url:"+url_of_input_file); 1053 1053 console.log("or object:"); … … 1076 1076 console.log(data[0]); 1077 1077 1078 var childColumn = "Chemin source"; 1079 var parentColumn = "Parent"; 1080 var accessColumn = "Access"; 1081 var descriptionColumn = "Description"; 1078 /* 1079 * Acces: "SP + BA" 1080 Chemin source: "RESSOURCES_HUMAINES" 1081 Parent: "Partage" 1082 Remarques: "Trouver un nom qui indique la nature du partage" 1083 * 1084 */ 1082 1085 1086 var childColumn = maxicharts_d3js_ajax_shortcode_param.child_col;//"Chemin source"; 1087 var parentColumn = maxicharts_d3js_ajax_shortcode_param.child_col;//"Parent"; 1088 /*var accessColumn = "Access"; 1089 var descriptionColumn = "Description";*/ 1090 // parent_col="Parent" child_col="Chemin source" more_infos_1_col="Acces" more_infos_1_col="Remarques" 1083 1091 1084 1092 var stratify = d3.stratify() … … 1092 1100 console.log("After stratify:"); 1093 1101 console.log(root); 1094 processTreeList(root, width, height, containerName );1102 processTreeList(root, width, height, containerName, maxicharts_d3js_ajax_shortcode_param); 1095 1103 1096 1104 }) -
maxicharts-d3js-add-on/trunk/js/maxicharts-d3js-frontend.js
r2259662 r2289894 105 105 } else if (type == "tree"){ 106 106 // create tree from file - CSV or JSON 107 var myTree = new MaxiChartsCollapsibleTree(element, null, width, height,'#visualization' );107 var myTree = new MaxiChartsCollapsibleTree(element, null, width, height,'#visualization', maxicharts_d3js_ajax_object); 108 108 } 109 109 } else if (type == 'sunburst'){ -
maxicharts-d3js-add-on/trunk/maxicharts-d3js.php
r2259861 r2289894 595 595 'height' => '500px', 596 596 'groups' => '', 597 'type' => 'sunburst' 597 'type' => 'sunburst', 598 'parent_col' => 'parent', 599 'child_col' => 'child', 600 'more_infos_1_col' => 'Acces', 601 'more_infos_2_col' => 'Remarques', 598 602 ), $attributes); 603 // parent_col="Parent" child_col="Chemin source" more_infos_1_col="Acces" more_infos_1_col="Remarques" 599 604 $show_buttons = isset($a['show_buttons']) ? boolval($a['show_buttons']) : true; 600 605 $data_path = isset($a['data_path']) ? $a['data_path'] : ''; … … 626 631 $this->MCD3JS_enqueue_scripts($type); 627 632 //$d3jsKey = 'network-frontend-js'; 628 wp_localize_script($this->d3js_frontend_key, 'maxicharts_d3js_ajax_object', array(633 $localized_array = array_merge($a, array( 629 634 'ajax_url' => admin_url('admin-ajax.php'), 630 635 'height' => $height, … … 634 639 'gf_form_id' => $gf_form_id, 635 640 )); 641 642 wp_localize_script($this->d3js_frontend_key, 'maxicharts_d3js_ajax_object', $localized_array); 643 644 645 636 646 $buttons = '<p class="maxicharts_d3js_button_bar"> 637 647 <input type="button" id="lastMonth" value="Last month"><br>
Note: See TracChangeset
for help on using the changeset viewer.