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

feat(singlestat): make sparkline height dynamic

closes #3553
bergquist пре 10 година
родитељ
комит
5de69b288f
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      public/app/plugins/panels/singlestat/singleStatPanel.js

+ 2 - 1
public/app/plugins/panels/singlestat/singleStatPanel.js

@@ -97,7 +97,8 @@ function (angular, app, _, $) {
             plotCss.bottom = '5px';
             plotCss.bottom = '5px';
             plotCss.left = '-5px';
             plotCss.left = '-5px';
             plotCss.width = (width - 10) + 'px';
             plotCss.width = (width - 10) + 'px';
-            plotCss.height = (height - 45) + 'px';
+            var dynamicHeightMargin = height <= 100 ? 5 : (Math.round((height/100)) * 15) + 5;
+            plotCss.height = (height - dynamicHeightMargin) + 'px';
           }
           }
           else {
           else {
             plotCss.bottom = "0px";
             plotCss.bottom = "0px";