Skip to content

Commit

Permalink
remove wrong angular timer
Browse files Browse the repository at this point in the history
  • Loading branch information
denzelsN committed Oct 20, 2016
1 parent 3c5bb40 commit 5d31c2a
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 179 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,28 @@
link: function postLink(scope, element, attrs) {

// define variables
var sId, oChart;
var sId = "", oChart;

// define variables of methods
var setIdAutomatically, setWidthHeight, render, showCursorAt, resize;

/**
* set id automatically
*/
setIdAutomatically = function () {
function setIdAutomatically() {
sId = 'multipleValueAxesId-' + scope.namespace;
element.attr('id', sId);
};
}

function hasId() {
return sId === "" ? false : true;
}

/**
* set width height
* @param w
* @param h
*/
setWidthHeight = function (w, h) {
function setWidthHeight(w, h) {
if (w) element.css('width', w);
if (h) element.css('height', h);
};
}

function renderUpdate(data) {
oChart.dataProvider = data;
oChart.validateData();
}

/**
* render
* @param chartData
*/
render = function (chartData) {
function render(chartData) {
var options = {
"type": "serial",
"theme": "light",
Expand Down Expand Up @@ -131,13 +125,9 @@
scope.$emit( "activeTraceChartDirective.cursorChanged." + scope.namespace, event);
});
});
};
}

/**
* show cursor at
* @param category
*/
showCursorAt = function (category) {
function showCursorAt(category) {
if (category) {
if (angular.isNumber(category)) {
category = oChart.dataProvider[category].time;
Expand All @@ -146,22 +136,23 @@
} else {
oChart.chartCursor.hideCursor();
}
};
}

/**
* resize
*/
resize = function () {
function resize() {
if (oChart) {
oChart.validateNow();
oChart.validateSize();
}
};
}

scope.$on( "activeTraceChartDirective.initAndRenderWithData." + scope.namespace, function (event, data, w, h) {
setIdAutomatically();
setWidthHeight(w, h);
render( data );
if ( hasId() ) {
renderUpdate( data );
} else {
setIdAutomatically();
setWidthHeight(w, h);
render(data);
}
});

scope.$on( "activeTraceChartDirective.showCursorAt." + scope.namespace, function (event, category) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@
}
oProgressBarService.setLoading(80);
showCharts(result);
$timeout(function () {
oProgressBarService.setLoading(100);
oProgressBarService.stopLoading();
}, 700);
oProgressBarService.setLoading(100);
oProgressBarService.stopLoading();
callback();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,28 @@
link: function postLink(scope, element, attrs) {

// define variables
var sId, oChart;
var sId = "", oChart;

// define variables of methods
var setIdAutomatically, setWidthHeight, render, showCursorAt, resize;

/**
* set id automatically
*/
setIdAutomatically = function () {
function setIdAutomatically() {
sId = 'multipleValueAxesId-' + scope.namespace;
element.attr('id', sId);
};
}

function hasId() {
return sId === "" ? false : true;
}

/**
* set width height
* @param w
* @param h
*/
setWidthHeight = function (w, h) {
function setWidthHeight(w, h) {
if (w) element.css('width', w);
if (h) element.css('height', h);
};
}

function renderUpdate(data) {
oChart.dataProvider = data;
oChart.validateData();
}

/**
* render
* @param chartData
*/
render = function (chartData) {
function render(chartData) {
var options = {
"type": "serial",
"theme": "light",
Expand Down Expand Up @@ -129,13 +123,9 @@
scope.$emit('cpuLoadChartDirective.cursorChanged.' + scope.namespace, event);
});
});
};
}

/**
* show cursor at
* @param category
*/
showCursorAt = function (category) {
function showCursorAt(category) {
if (category) {
if (angular.isNumber(category)) {
category = oChart.dataProvider[category].time;
Expand All @@ -144,37 +134,29 @@
} else {
oChart.chartCursor.hideCursor();
}
};
}

/**
* resize
*/
resize = function () {
function resize() {
if (oChart) {
oChart.validateNow();
oChart.validateSize();
}
};
}

/**
* scope event on cpuLoadChartDirective.initAndRenderWithData.namespace
*/
scope.$on('cpuLoadChartDirective.initAndRenderWithData.' + scope.namespace, function (event, data, w, h) {
setIdAutomatically();
setWidthHeight(w, h);
render(data);
if ( hasId() ) {
renderUpdate( data );
} else {
setIdAutomatically();
setWidthHeight(w, h);
render(data);
}
});

/**
* scope event on cpuLoadChartDirective.showCursorAt.namespace
*/
scope.$on('cpuLoadChartDirective.showCursorAt.' + scope.namespace, function (event, category) {
showCursorAt(category);
});

/**
* scope event on cpuLoadChartDirective.resize.namespace
*/
scope.$on('cpuLoadChartDirective.resize.' + scope.namespace, function (event) {
resize();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,29 @@
namespace: '@' // string value
},
link: function postLink(scope, element, attrs) {
console.log( "------init" );

// define variables
var sId, oChart;
var sId = "", oChart;

// define variables of methods
var setIdAutomatically, setWidthHeight, render, showCursorAt, resize;

/**
* set id automatically
*/
setIdAutomatically = function () {
function setIdAutomatically() {
sId = 'multipleValueAxesId-' + scope.namespace;
element.attr('id', sId);
};
}
function hasId() {
return sId === "" ? false : true;
}

/**
* set width height
* @param w
* @param h
*/
setWidthHeight = function (w, h) {
function setWidthHeight(w, h) {
if (w) element.css('width', w);
if (h) element.css('height', h);
};
}

function renderUpdate(data) {
oChart.dataProvider = data;
oChart.validateData();
}

/**
* render
* @param chartData
*/
render = function (chartData) {
function render(chartData) {
var options = {
"type": "serial",
"theme": "light",
Expand Down Expand Up @@ -145,13 +138,9 @@
scope.$emit('jvmMemoryChartDirective.cursorChanged.' + scope.namespace, event);
});
});
};
}

/**
* show cursor at
* @param category
*/
showCursorAt = function (category) {
function showCursorAt(category) {
if (category) {
if (angular.isNumber(category)) {
category = oChart.dataProvider[category].time;
Expand All @@ -160,37 +149,26 @@
} else {
oChart.chartCursor.hideCursor();
}
};
}

/**
* resize
*/
resize = function () {
function resize() {
if (oChart) {
oChart.validateNow();
oChart.validateSize();
}
};

/**
* scope event on jvmMemoryChartDirective.initAndRenderWithData.namespace
*/
}
scope.$on('jvmMemoryChartDirective.initAndRenderWithData.' + scope.namespace, function (event, data, w, h) {
setIdAutomatically();
setWidthHeight(w, h);
render(data);
if ( hasId() ) {
renderUpdate( data );
} else {
setIdAutomatically();
setWidthHeight(w, h);
render(data);
}
});

/**
* scope event on jvmMemoryChartDirective.showCursorAt.namespace
*/
scope.$on('jvmMemoryChartDirective.showCursorAt.' + scope.namespace, function (event, category) {
showCursorAt(category);
});

/**
* scope event on jvmMemoryChartDirective.resize.namespace
*/
scope.$on('jvmMemoryChartDirective.resize.' + scope.namespace, function (event) {
resize();
});
Expand Down

0 comments on commit 5d31c2a

Please sign in to comment.