Ad Widget

Collapse

Sorting order in graph popup/overlay

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fwilhelmsson
    Junior Member
    • Jan 2020
    • 4

    #1

    Sorting order in graph popup/overlay

    Hi,

    Is it possible to change the sorting order in a graph popup/overlay so that it show the item with highest value first instead of alphabetical order?

    Click image for larger version

Name:	2020-09-09_21-07-15.png
Views:	1861
Size:	139.7 KB
ID:	408845

    Zabbix version: 5.0.4

    BR
    Fredrik
  • fwilhelmsson
    Junior Member
    • Jan 2020
    • 4

    #2
    Originally posted by splitek
    ...or show the row with highest value in bold.
    No.
    It is a future request.
    Ok, thanks for info!
    Do the feature request have a name/number?

    Comment

    • rlaunch
      Junior Member
      • Aug 2021
      • 1

      #3
      We have quite a lot of hosts displayed on one graph, and many are cut off from the tooltip. We too would like the ability to sort by the host's value, so the hosts with the highest value would be at the top for example.

      Comment

      • gofree
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2017
        • 400

        #4
        vote for it if you need it ( and its a nice feature indeed )

        Comment

        • cbigler
          Junior Member
          • Jan 2021
          • 10

          #5
          This is an older post, but I was searching for this exact thing today. It still hasn't been addressed in a feature update, but a working solution was posted by https://support.zabbix.com/secure/Vi...pa?name=sivann here [ZBXNEXT-4769] New Graph Widget usability improvements - ZABBIX SUPPORT:

          Quick hack to sort tooltip by value, tested on zabbix 7.0.4:

          in /usr/share/zabbix/js/class.csvggraph.js , just before:
          Code:
                      points.forEach(function(point) {
                          var point_highlight = point.g.querySelectorAll('.svg-point-highlight')[0];
          prepend this:
          Code:
           
                    //START (sort by value)
                      function getMult(str) {
                          var unit;
                          var mult;
                          mult=1.0
          
                          if (!str)
                              return mult
          
                          if (str.split(' ').length <2) {
                              return mult;
                          }
                          unit = str.split(' ')[1][0]
                          if (unit == 'K') {
                              mult = 1024.0;
                          }
                          else if (unit == 'M')
                              mult = 1024*1024.0;
                          else if (unit == 'G')
                              mult = 1024*1024*1024.0;
                          else if (unit == 'T')
                              mult = 1024*1024*1024*1024.0;
                          return mult;
                      }
                     
                      points.sort(function(a, b) { //order by float value
                        var keyA = parseFloat(a.v), keyB = parseFloat(b.v);
                        var multA = getMult(a.v)
                        var multB = getMult(b.v)               
                        if (keyA*multA < keyB*multB) return 1;
                        if (keyA*multA > keyB*multB) return -1;
                        return 0;
                      });
                      //END (sort by value)
          It worked great for me.

          Comment


          • Barbue
            Barbue commented
            Editing a comment
            I made an account to say that this worked perfect for me! Thank you so much!
        Working...