|
|
|
@ -621,7 +621,7 @@ Prometheus.Graph.prototype.updateGraph = function() {
|
|
|
|
|
var yAxis = new Rickshaw.Graph.Axis.Y({ |
|
|
|
|
graph: self.rickshawGraph, |
|
|
|
|
orientation: "left", |
|
|
|
|
tickFormat: Rickshaw.Fixtures.Number.formatKMBT, |
|
|
|
|
tickFormat: this.formatKMBT, |
|
|
|
|
element: self.yAxis[0], |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
@ -734,6 +734,49 @@ Prometheus.Graph.prototype.remove = function() {
|
|
|
|
|
self.handleChange(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
Prometheus.Graph.prototype.formatKMBT = function(y) { |
|
|
|
|
var abs_y = Math.abs(y); |
|
|
|
|
if (abs_y >= 1e24) { |
|
|
|
|
return (y / 1e24).toString() + "Y"; |
|
|
|
|
} else if (abs_y >= 1e21) { |
|
|
|
|
return (y / 1e21).toString() + "Z"; |
|
|
|
|
} else if (abs_y >= 1e18) { |
|
|
|
|
return (y / 1e18).toString() + "E"; |
|
|
|
|
} else if (abs_y >= 1e15) { |
|
|
|
|
return (y / 1e15).toString() + "P"; |
|
|
|
|
} else if (abs_y >= 1e12) { |
|
|
|
|
return (y / 1e12).toString() + "T"; |
|
|
|
|
} else if (abs_y >= 1e9) { |
|
|
|
|
return (y / 1e9).toString() + "G"; |
|
|
|
|
} else if (abs_y >= 1e6) { |
|
|
|
|
return (y / 1e6).toString() + "M"; |
|
|
|
|
} else if (abs_y >= 1e3) { |
|
|
|
|
return (y / 1e3).toString() + "k"; |
|
|
|
|
} else if (abs_y >= 1) { |
|
|
|
|
return y |
|
|
|
|
} else if (abs_y === 0) { |
|
|
|
|
return y |
|
|
|
|
} else if (abs_y <= 1e-24) { |
|
|
|
|
return (y / 1e-24).toString() + "y"; |
|
|
|
|
} else if (abs_y <= 1e-21) { |
|
|
|
|
return (y / 1e-21).toString() + "z"; |
|
|
|
|
} else if (abs_y <= 1e-18) { |
|
|
|
|
return (y / 1e-18).toString() + "a"; |
|
|
|
|
} else if (abs_y <= 1e-15) { |
|
|
|
|
return (y / 1e-15).toString() + "f"; |
|
|
|
|
} else if (abs_y <= 1e-12) { |
|
|
|
|
return (y / 1e-12).toString() + "p"; |
|
|
|
|
} else if (abs_y <= 1e-9) { |
|
|
|
|
return (y / 1e-9).toString() + "n"; |
|
|
|
|
} else if (abs_y <= 1e-6) { |
|
|
|
|
return (y / 1e-6).toString() + "µ"; |
|
|
|
|
} else if (abs_y <=1e-3) { |
|
|
|
|
return (y / 1e-3).toString() + "m"; |
|
|
|
|
} else if (abs_y <= 1) { |
|
|
|
|
return y |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function escapeHTML(string) { |
|
|
|
|
var entityMap = { |
|
|
|
|
"&": "&", |
|
|
|
|