Pārlūkot izejas kodu

HUE-494. Adding units to metadata and displaying in tip if present.

Marcus McLaughlin 14 gadi atpakaļ
vecāks
revīzija
11e915a2f1
1 mainītis faili ar 6 papildinājumiem un 1 dzēšanām
  1. 6 1
      desktop/core/static/js/Source/Hue/HueChart.Box.js

+ 6 - 1
desktop/core/static/js/Source/Hue/HueChart.Box.js

@@ -580,6 +580,7 @@ HueChart.Box = new Class({
 		//Given a series object, return the value that should be displayed
 		getValueForDisplay: function(seriesObject) {
 			var value = seriesObject.value;
+			var units = "";
 			//If metadata exists
 			if(this.hasMetadata(seriesObject.name)) {
 				var metadata = this.metadata[seriesObject.name];
@@ -588,13 +589,17 @@ HueChart.Box = new Class({
 					//Multiply the charting value by amplitude
 					value = seriesObject.value.toFloat() * metadata['amplitude'];
 				}
+				if ($defined(metadata.units)){
+					//Set units to the string
+					units = metadata.units;
+				}
 			} else {
 				//Format bytes properly and return
 				if (this.options.yType == 'bytes') {
 					return seriesObject.value.toInt().convertFileSize();
 				}
 			}
-			return String(value.round(2));
+			return String(value.round(2)) + " " + units;
 		},
 		//Updates the display of the currently visible tip
 		updatePointValue: function(seriesList) {