Преглед изворни кода

Added scientific notation as a unit for #7763 (#7781)

Matt пре 8 година
родитељ
комит
578ba9bbd5
1 измењених фајлова са 14 додато и 9 уклоњено
  1. 14 9
      public/app/core/utils/kbn.js

+ 14 - 9
public/app/core/utils/kbn.js

@@ -394,6 +394,10 @@ function($, _) {
     return "0x" + hexString;
     return "0x" + hexString;
   };
   };
 
 
+  kbn.valueFormats.sci = function(value, decimals) {
+    return value.toExponential(decimals);
+  };
+
   // Currencies
   // Currencies
   kbn.valueFormats.currencyUSD = kbn.formatBuilders.currency('$');
   kbn.valueFormats.currencyUSD = kbn.formatBuilders.currency('$');
   kbn.valueFormats.currencyGBP = kbn.formatBuilders.currency('£');
   kbn.valueFormats.currencyGBP = kbn.formatBuilders.currency('£');
@@ -703,15 +707,16 @@ function($, _) {
       {
       {
         text: 'none',
         text: 'none',
         submenu: [
         submenu: [
-          {text: 'none' ,             value: 'none'       },
-          {text: 'short',             value: 'short'      },
-          {text: 'percent (0-100)',   value: 'percent'    },
-          {text: 'percent (0.0-1.0)', value: 'percentunit'},
-          {text: 'Humidity (%H)',     value: 'humidity'   },
-          {text: 'ppm',               value: 'ppm'        },
-          {text: 'decibel',           value: 'dB'         },
-          {text: 'hexadecimal (0x)',  value: 'hex0x'      },
-          {text: 'hexadecimal',       value: 'hex'        },
+          {text: 'none' ,               value: 'none'       },
+          {text: 'short',               value: 'short'      },
+          {text: 'percent (0-100)',     value: 'percent'    },
+          {text: 'percent (0.0-1.0)',   value: 'percentunit'},
+          {text: 'Humidity (%H)',       value: 'humidity'   },
+          {text: 'ppm',                 value: 'ppm'        },
+          {text: 'decibel',             value: 'dB'         },
+          {text: 'hexadecimal (0x)',    value: 'hex0x'      },
+          {text: 'hexadecimal',         value: 'hex'        },
+          {text: 'scientific notation', value: 'sci'        },
         ]
         ]
       },
       },
       {
       {