diff options
Diffstat (limited to 'ishtar_common/static/js/ishtar.js')
| -rw-r--r-- | ishtar_common/static/js/ishtar.js | 23 | 
1 files changed, 19 insertions, 4 deletions
| diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js index caff11986..40592f0db 100644 --- a/ishtar_common/static/js/ishtar.js +++ b/ishtar_common/static/js/ishtar.js @@ -51,6 +51,15 @@ function manage_async_link(event){      if (modal_open) $(modal_open).modal('show');  } +text_truncate = function(str, length) { +    var ending = "..."; +    if (str.length > length) { +        return str.substring(0, length - ending.length) + ending; +    } else { +        return str; +    } +}; +  /* default function to prevent undefined */  function get_next_table_id(){}  function get_previous_table_id(){} @@ -1502,8 +1511,10 @@ var _render_stats_table = function(stats_values, name){              current_row = new Array();              html += "<tr><td>" + stats_values[idx][0] + "</td>";              current_row.push(stats_values[idx][0]); -            html += "<td>" + stats_values[idx][1] + "</td></tr>"; -            current_row.push(stats_values[idx][1]); +            var cvalue = stats_values[idx][1]; +            if (cvalue == null) cvalue = 0; +            html += "<td>" + cvalue + "</td></tr>"; +            current_row.push(cvalue);              rows.push(current_row);          }      } @@ -1573,11 +1584,11 @@ var render_stats = function(stats_values, name){      };      if (modality_2 && modality_2 != modality_1){          for (idx in stats_values){ -            ticks.push(stats_values[idx][0]); +            ticks.push(text_truncate(stats_values[idx][0], 40));              var serie_values = stats_values[idx][1];              var current_serie_values = new Array();              for (inner_idx in serie_values){ -                var serie_value = serie_values[inner_idx][0]; +                var serie_value = text_truncate(serie_values[inner_idx][0], 40);                  if (series.indexOf(serie_value) == -1){                      series.push(serie_value);                      var fill_values = new Array(); @@ -1601,6 +1612,9 @@ var render_stats = function(stats_values, name){          }          stats_xaxis['ticks'] = ticks;      } else { +        for (idx in stats_values){ +            stats_values[idx][0] = text_truncate(stats_values[idx][0], 40); +        }          jqvalues = [stats_values];          series.push("Total");          if (stats_type != "pie"){ @@ -1654,6 +1668,7 @@ var render_stats = function(stats_values, name){          stats_options["cursor"] = {                  show: true,                  zoom: true, +                constrainOutsideZoom: false,                  showTooltip: false          }      } | 
