Advertisement
globiws

pf_js_app_dash_table_progress_bars

Sep 8th, 2020
918
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // configuration
  2. var column_number = 2;
  3. var color_function = function(value) {
  4.     if ( value < 20 ) return "red";
  5.     if ( value < 80 ) return "grey";
  6.     return "green";
  7. }
  8. var colors = ["red", "blue", "green"];
  9. // end configuration
  10. $(".zui-chart[data-type=table] table tbody tr").each(function(){
  11.     var cell = $(this).find("td").get(column_number-1);
  12.     var val = parseInt($(cell).text());
  13.     var html = '<div style="background-color:'+color_function(val)+';width:'+parseInt(val)+'%; display:inline-block;height:100%;margin-right:0.3em" title="'+val+'"><span style="font-size: 0.8em;padding: 0.1em 0.4em;color: black">'+val+'</span></div>';
  14.     $(cell).html(html).css("text-align", "left");
  15. });
  16.  
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement