Browse Source

fixed bug in render graph

Piotr Labudda 7 years ago
parent
commit
752ddcd4c0

+ 3 - 3
theme/assets/js/graph/sankey-init-widget.js

@@ -308,14 +308,14 @@ function sankeyNodeLabel(i) {
 		// console.log('renderGraph data', data)
 
 		htmlNode.append("rect").attr("x",0).attr("y",0).attr("width","100%").attr("height","100%").attr("fill","white")
-		width = (opts.width) ? opts.width - margin.left - margin.right : 1020
-		height = (opts.height) ? opts.height : 500
 		margin = {
 			top: 10,
-			right: 10,
+			right: 20,
 			bottom: 10,
 			left: 40
 		};
+		width = (opts.width) ? opts.width - margin.left - margin.right : 1020;
+		height = (opts.height) ? opts.height : 500;
 		htmlNode.attr("width", width + margin.left + margin.right).attr("height", height + margin.top + margin.bottom)
 		svg = htmlNode.append("g").attr("transform", "translate(" + margin.left + "," + margin.top + ")");
 

+ 4 - 5
theme/bocian.php

@@ -14,6 +14,10 @@ class Theme_bocian extends ThemeDefault {
 			.AjaxTable tbody .stickyCol1 { font-size:12px }
 			.popover-content li { text-align:left; font-size:14px }
 		");
+		UI::inlineRawJS(dirname(__FILE__) . '/assets/js/graph/d3.v3.min.js');
+		UI::inlineRawJS(dirname(__FILE__) . '/assets/js/graph/csaladenes/sankey/sankey.js');
+		// UI::inlineRawJS(dirname(__FILE__) . '/assets/js/graph/csaladenes/sankey/sankey-init.js');
+		UI::inlineRawJS(dirname(__FILE__) . '/assets/js/graph/sankey-init-widget.js');
 	}
 
 
@@ -39,11 +43,6 @@ class Theme_bocian extends ThemeDefault {
 				'URL_FETCH_BI_AUDIT_PROGRESS' => Router::getRoute('UrlAction_Bocian')->getLink('fetchProgressAjax')
 			]);
 		}
-		// graph lib
-		UI::inlineRawJS(dirname(__FILE__) . '/assets/js/graph/d3.v3.min.js');
-		UI::inlineRawJS(dirname(__FILE__) . '/assets/js/graph/csaladenes/sankey/sankey.js');
-		// UI::inlineRawJS(dirname(__FILE__) . '/assets/js/graph/csaladenes/sankey/sankey-init.js');
-		UI::inlineRawJS(dirname(__FILE__) . '/assets/js/graph/sankey-init-widget.js');
 	}
 
 	function login($data) {

+ 2 - 2
tools/Bocian.php

@@ -2821,7 +2821,7 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 					$formFilterHeadDesc = '<p>Liczba pozycji na liście: <span id="smad-filter-desc-kontrahenci">0</span></p>';
 					$countSelectedItem = '<div>Wybrano: <span id="count-selected-item-kontrahenci">0</span> <span><a title="wyczyść zapamietanych kontrahentów"  class="link-primary" onClick="clearListLocalStorageByType(\'kontrahenci\')"><small>(wyczyść)</small></a></span></div>';
 
-					$graphView = '<div class="smad-kontrahenci-graph-view" style="display: none;"></div>';
+					$graphView = '<div class="smad-kontrahenci-graph-view" id="smad-kontrahenci-graph-view" style="display: none;"></div>';
 
 					$csvExampleKontrahenci = Request::getPathUri() . 'projects/bocian/theme/assets/file_example/kontrahenci_example.zip';
 					$formAddNewData ='
@@ -2922,7 +2922,7 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 					$formFilterHeadDesc = '<p>Liczba pozycji na liście: <span id="smad-filter-desc-pracownicy">0</span></p>';
 					$countSelectedItem = '<div>Wybrano: <span id="count-selected-item-pracownicy">0</span> <span><a title="wyczyść zapamietanych pracowników" class="link-primary" onClick="clearListLocalStorageByType(\'pracownicy\')"><small>(wyczyść)</small></a></span></div>';
 
-					$graphView = '<div class="smad-pracownicy-graph-view" style="display: none;"></div>';
+					$graphView = '<div class="smad-pracownicy-graph-view" id="smad-pracownicy-graph-view" style="display: none;"></div>';
 
 					$csvExamplePracownicy = Request::getPathUri() . 'projects/bocian/theme/assets/file_example/pracownicy_example.zip';
 					$formAddNewData ='

+ 1 - 1
tools/Bocian.php.graphShowHide.js

@@ -5,7 +5,7 @@ var renderGraph = global.renderGraph; // @from sankey-init
 var DBG = DBG || 0;
 
 function graphShowHide(nameSection) {
-	var node = $('.smad-'+nameSection+'-graph-view')
+	var node = $('#smad-'+nameSection+'-graph-view')
 	if (!node || !node.length) return;
 	if ('block' !== node.css('display')) {
 		node.show()