mirror of
https://github.com/timberjoegithub/grafana-statusmap.git
synced 2026-07-22 15:53:09 +00:00
card width bind to panelWidth
This commit is contained in:
@@ -142,17 +142,23 @@ export class StatusHeatmapCtrl extends MetricsPanelCtrl {
|
|||||||
|
|
||||||
// override calculateInterval for discrete color mode
|
// override calculateInterval for discrete color mode
|
||||||
calculateInterval = () => {
|
calculateInterval = () => {
|
||||||
let chartWidth = this.graph.chartWidth;
|
let panelWidth = Math.ceil($(window).width() * (this.panel.gridPos.w / 24));
|
||||||
|
// approximate chartWidth because y axis ticks not rendered yet on first data receive.
|
||||||
if (chartWidth == -1) {
|
let chartWidth = _.max([
|
||||||
// approximate panel width
|
panelWidth - 200,
|
||||||
chartWidth = Math.ceil($(window).width() * (this.panel.gridPos.w / 24));
|
panelWidth/2
|
||||||
}
|
]);
|
||||||
|
|
||||||
let minCardWidth = this.panel.cards.cardMinWidth;
|
let minCardWidth = this.panel.cards.cardMinWidth;
|
||||||
let minSpacing = this.panel.cards.cardSpacing;
|
let minSpacing = this.panel.cards.cardSpacing;
|
||||||
let maxCardsCount = Math.ceil((chartWidth-minCardWidth) / (minCardWidth + minSpacing));
|
let maxCardsCount = Math.ceil((chartWidth-minCardWidth) / (minCardWidth + minSpacing));
|
||||||
|
|
||||||
|
console.log("CALC INT", {
|
||||||
|
"chartWidth": chartWidth,
|
||||||
|
"panelWidth": panelWidth,
|
||||||
|
"maxCardsCount": maxCardsCount,
|
||||||
|
});
|
||||||
|
|
||||||
let intervalMs;
|
let intervalMs;
|
||||||
let rangeMs = this.range.to.valueOf() - this.range.from.valueOf();
|
let rangeMs = this.range.to.valueOf() - this.range.from.valueOf();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user