html/modules/pong-histogram/pong-histogram.js
function pongHistogram_UpdateBars( divId, dta, xMin, xMax ) {
  log( "pongHistogram", "UpdateBars "+divId);

  var pmd = moduleConfig[ divId ];
  var cnt = ( pmd.blockCount ? pmd.blockCount : 10 );
  // get y-axis scaling
  var yMax = pmd.yAxisMax;
  if ( !yMax || yMax == 'auto' ) { 
    yMax = 0;
    for ( var i = 0; i < cnt; i++ ) {
      if ( parseFloat( dta[i][ pmd.dataY ] ) > yMax ) { 
        yMax = parseFloat( dta[i][ pmd.dataY ] );
      }
    }
  }
  var yH = $( '.HistogramBlockContainer' ).height();
  log( "pongHistogram", 'yH='+yH);

  // scale bars in % height
  for ( var i = 0; i < cnt; i++ ) {
    //var bar = pongHistogram[ divId ][i];
    var h = parseFloat( dta[i][ pmd.dataY ] ) / parseFloat( yMax ) * yH;
    h = ( h > 100 ? 100 : h );
    log( "pongHistogram", ' bar '+i+' '+ JSON.stringify( dta[i]) + ' '+ pmd.dataY+' '+ pmd.xAxisMax + ' h='+h );
    $( '#'+divId+'bar'+i ).height( h+'px' ); // set height of bar
    $( '#'+divId+'bar'+i ).attr( 'title', dta[i][ pmd.dataY ]+'#' );
    if (  dta[i][ pmd.dataX ] ) { // update label
      $( '#'+divId+'xLabel'+i ).html( dta[i][ pmd.dataX ] );      
    } 
  }  
  
  log( "pongHistogram", 'UpdateBars end' );
  return true;
}
function pongHistogram_UpdateBars( divId, dta, xMin, xMax ) {
  log( "pongHistogram", "UpdateBars "+divId);

  var pmd = moduleConfig[ divId ];
  var cnt = ( pmd.blockCount ? pmd.blockCount : 10 );
  // get y-axis scaling
  var yMax = pmd.yAxisMax;
  if ( !yMax || yMax == 'auto' ) { 
    yMax = 0;
    for ( var i = 0; i < cnt; i++ ) {
      if ( parseFloat( dta[i][ pmd.dataY ] ) > yMax ) { 
        yMax = parseFloat( dta[i][ pmd.dataY ] );
      }
    }
  }
  var yH = $( '.HistogramBlockContainer' ).height();
  log( "pongHistogram", 'yH='+yH);

  // scale bars in % height
  for ( var i = 0; i < cnt; i++ ) {
    //var bar = pongHistogram[ divId ][i];
    var h = parseFloat( dta[i][ pmd.dataY ] ) / parseFloat( yMax ) * yH;
    h = ( h > 100 ? 100 : h );
    log( "pongHistogram", ' bar '+i+' '+ JSON.stringify( dta[i]) + ' '+ pmd.dataY+' '+ pmd.xAxisMax + ' h='+h );
    $( '#'+divId+'bar'+i ).height( h+'px' ); // set height of bar
    $( '#'+divId+'bar'+i ).attr( 'title', dta[i][ pmd.dataY ]+'#' );
    if (  dta[i][ pmd.dataX ] ) { // update label
      $( '#'+divId+'xLabel'+i ).html( dta[i][ pmd.dataX ] );      
    } 
  }  
  
  log( "pongHistogram", 'UpdateBars end' );
  return true;
}
function pongHistogram_UpdateBars ( divId , dta , xMin , xMax ) { log ( "pongHistogram" , "UpdateBars " + divId ) ; var pmd = moduleConfig [ divId ] ; var cnt = ( pmd . blockCount ? pmd . blockCount : 10 ) ; // get y-axis scaling var yMax = pmd . yAxisMax ; if ( ! yMax || yMax == 'auto' ) { yMax = 0 ; for ( var i = 0 ; i < cnt ; i ++ ) { if ( parseFloat ( dta [ i ] [ pmd . dataY ] ) > yMax ) { yMax = parseFloat ( dta [ i ] [ pmd . dataY ] ) ; } } } var yH = $ ( '.HistogramBlockContainer' ) . height ( ) ; log ( "pongHistogram" , 'yH=' + yH ) ; // scale bars in % height for ( var i = 0 ; i < cnt ; i ++ ) { //var bar = pongHistogram[ divId ][i]; var h = parseFloat ( dta [ i ] [ pmd . dataY ] ) / parseFloat ( yMax ) * yH ; h = ( h > 100 ? 100 : h ) ; log ( "pongHistogram" , ' bar ' + i + ' ' + JSON . stringify ( dta [ i ] ) + ' ' + pmd . dataY + ' ' + pmd . xAxisMax + ' h=' + h ) ; $ ( '#' + divId + 'bar' + i ) . height ( h + 'px' ) ; // set height of bar $ ( '#' + divId + 'bar' + i ) . attr ( 'title' , dta [ i ] [ pmd . dataY ] + '#' ) ; if ( dta [ i ] [ pmd . dataX ] ) { // update label $ ( '#' + divId + 'xLabel' + i ) . html ( dta [ i ] [ pmd . dataX ] ) ; } } log ( "pongHistogram" , 'UpdateBars end' ) ; return true ; }
Change labels an height of histogram bars
Change labels an height of histogram bars