Merge pull request #11753 from grafana/11743_unit_revert

revert renaming of unit key ppm
pull/11763/head
Marcus Efraimsson 7 years ago committed by GitHub
commit 8f29d28572
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      public/app/core/utils/kbn.ts
  2. 3
      public/app/plugins/panel/graph/graph.ts

@ -596,7 +596,7 @@ kbn.valueFormats.radr = kbn.formatBuilders.decimalSIPrefix('R');
kbn.valueFormats.radsvh = kbn.formatBuilders.decimalSIPrefix('Sv/h'); kbn.valueFormats.radsvh = kbn.formatBuilders.decimalSIPrefix('Sv/h');
// Concentration // Concentration
kbn.valueFormats.conppm = kbn.formatBuilders.fixedUnit('ppm'); kbn.valueFormats.ppm = kbn.formatBuilders.fixedUnit('ppm');
kbn.valueFormats.conppb = kbn.formatBuilders.fixedUnit('ppb'); kbn.valueFormats.conppb = kbn.formatBuilders.fixedUnit('ppb');
kbn.valueFormats.conngm3 = kbn.formatBuilders.fixedUnit('ng/m3'); kbn.valueFormats.conngm3 = kbn.formatBuilders.fixedUnit('ng/m3');
kbn.valueFormats.conngNm3 = kbn.formatBuilders.fixedUnit('ng/Nm3'); kbn.valueFormats.conngNm3 = kbn.formatBuilders.fixedUnit('ng/Nm3');
@ -1101,7 +1101,7 @@ kbn.getUnitFormats = function() {
{ {
text: 'concentration', text: 'concentration',
submenu: [ submenu: [
{ text: 'parts-per-million (ppm)', value: 'conppm' }, { text: 'parts-per-million (ppm)', value: 'ppm' },
{ text: 'parts-per-billion (ppb)', value: 'conppb' }, { text: 'parts-per-billion (ppb)', value: 'conppb' },
{ text: 'nanogram per cubic metre (ng/m3)', value: 'conngm3' }, { text: 'nanogram per cubic metre (ng/m3)', value: 'conngm3' },
{ text: 'nanogram per normal cubic metre (ng/Nm3)', value: 'conngNm3' }, { text: 'nanogram per normal cubic metre (ng/Nm3)', value: 'conngNm3' },

@ -634,6 +634,9 @@ function graphDirective(timeSrv, popoverSrv, contextSrv) {
function configureAxisMode(axis, format) { function configureAxisMode(axis, format) {
axis.tickFormatter = function(val, axis) { axis.tickFormatter = function(val, axis) {
if (!kbn.valueFormats[format]) {
throw new Error(`Unit '${format}' is not supported`);
}
return kbn.valueFormats[format](val, axis.tickDecimals, axis.scaledDecimals); return kbn.valueFormats[format](val, axis.tickDecimals, axis.scaledDecimals);
}; };
} }

Loading…
Cancel
Save