mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
Did some jquery flot performance tuning, added text size cache that reduced render times by 25% (for single serie graphs)
This commit is contained in:
parent
a256d71ef9
commit
2e6c2347eb
23
public/vendor/jquery/jquery.flot.js
vendored
23
public/vendor/jquery/jquery.flot.js
vendored
@ -122,6 +122,7 @@ Licensed under the MIT license.
|
||||
// re-calculating them when the plot is re-rendered in a loop.
|
||||
|
||||
this._textCache = {};
|
||||
this._textSizeCache = window.flotTextSizeCache = window.flotTextSizeCache || {};
|
||||
}
|
||||
|
||||
// Resizes the canvas to the given dimensions.
|
||||
@ -368,12 +369,17 @@ Licensed under the MIT license.
|
||||
element.addClass(font);
|
||||
}
|
||||
|
||||
info = styleCache[text] = {
|
||||
width: element.outerWidth(true),
|
||||
height: element.outerHeight(true),
|
||||
element: element,
|
||||
positions: []
|
||||
};
|
||||
info = styleCache[text] = { element: element, positions: [] };
|
||||
|
||||
var size = null;// this._textSizeCache[text];
|
||||
if (size) {
|
||||
info.width = size.width;
|
||||
info.height = size.height;
|
||||
} else {
|
||||
info.width = element.outerWidth(true);
|
||||
info.height = element.outerHeight(true);
|
||||
this._textSizeCache[text] = { width: info.width, height: info.height };
|
||||
}
|
||||
|
||||
element.detach();
|
||||
}
|
||||
@ -1416,8 +1422,7 @@ Licensed under the MIT license.
|
||||
|
||||
var info = surface.getTextInfo(layer, t.label, font, null, maxWidth);
|
||||
|
||||
/// Grafana fix, add +1 to label width
|
||||
labelWidth = Math.max(labelWidth, info.width + 1);
|
||||
labelWidth = Math.max(labelWidth, info.width);
|
||||
labelHeight = Math.max(labelHeight, info.height);
|
||||
}
|
||||
|
||||
@ -1729,8 +1734,6 @@ Licensed under the MIT license.
|
||||
axis.delta = delta;
|
||||
axis.tickDecimals = Math.max(0, maxDec != null ? maxDec : dec);
|
||||
axis.tickSize = opts.tickSize || size;
|
||||
// grafana addition
|
||||
axis.scaledDecimals = axis.tickDecimals - Math.floor(Math.log(axis.tickSize) / Math.LN10);
|
||||
|
||||
// Time mode was moved to a plug-in in 0.8, and since so many people use it
|
||||
// we'll add an especially friendly reminder to make sure they included it.
|
||||
|
Loading…
Reference in New Issue
Block a user