Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Working great for me in 4.1

    Yep, Works Great.
    You are missing one of the callbacks and you need to actually format the data arrays properly.

    Like Thus:

    function psm_filter_charts_data( $data, $chart_id, $type ) {
      global $current_user;
        get_currentuserinfo();
      	$Y = date("Y");
      	$Py = $Y-1;
      	$mssql = new db_mssql();
    
    	  $params = array(stripslashes($current_user->user_login),SQLSRV_PARAM_IN,SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR),SQLSRV_SQLTYPE_VARCHAR('30'));
        $return = sqlsrv_query( $mssql->db, "{call SomeStoredProc(?)}", $params );
    
    	  if ( !$return )
    	    $this->html =  '<center><<Unable to retrieve survey data>></center>';
    	  else
    	  {
    	    if($record = sqlsrv_fetch_array($return)){
    	     $VG = round(($record['PYVeryGood']/$record['PYRegionVG'])*100);//Previous Year
    	  	 $VGYTD = round(($record['YTDVeryGood']/$record['YTDRegionVG'])*100);//Current Year To Date
    
    	  	 	$data = array(
    				    // the first row of data
    				    array(
    				        "$Y YTD", // the value of the first series
    				        $VGYTD
    				    ),
    				    // the second row of data
    				    array(
    				        "$Py", // the value of the first series
    				        $VG
    				    )
    				);
    
    	  	}
    	  }
    	  /*
    	  echo "Sample Sizes: <br /> $Y YTD: ".$record['YTDSampleSize']."<br />";
    	     echo "$Py: ".$record['PYSampleSize']."<br />";
    	  */
    	  $pqm = new Patient_Satisfaction_Metric();
    	  echo "<div id='pqmTable' style='display:none;'>"
    	       .$pqm->html.$pqm->css
    	       ."</div>";
    	  echo "
    	  <style>
    	    #visualizer-91{ cursor:pointer; }
    	  </style>
    	  <script>
    	  jQuery(document).ready( function() {
    	  jQuery('#visualizer-91').click(function(){location.href='/pp/patsat/'});
    	  jQuery('#visualizer-91').hover(function(){
    	    var title = jQuery('#pqmTable').html();
    	    jQuery(this).data('tipText', title).removeAttr('title');
    	    jQuery(\"<p class='tooltip'></p>\")
    	      .html(title)
    	      .appendTo('body')
    	      .fadeIn('slow');
    	    },function(){
    	      jQuery(this).attr('title', jQuery(this).data('tipText'));
            jQuery('.tooltip').remove();
    	    }).mousemove(function(e) {
                    var mousex = e.pageX + 20; //Get X coordinates
                    var mousey = e.pageY + 10; //Get Y coordinates
    
                    jQuery('.tooltip')
                    .css({ top: mousey,
                           left: mousex,
                           position: 'absolute',
                           background: '#EFF4F8',
                           border:'1px solid #004B73',
                           padding: '10px' })
    	    });
    	  });</script>";
        return $data;
    }
    add_filter( 'psm-get-chart-data', 'psm_filter_charts_data', 10, 3 );
    
    function psm_filter_charts_series( $series, $chart_id, $type ) {
    	     $series = array(
    				    // the first series
    				    array(
    				        'label' => 'Patient Satisfaction', // the label of the series
    				        'type' => 'string' // the type of the series
    				    ),
    				    // the second series
    				    array(
    				        'label' => 'Value', // the label of the series
    				        'type' => 'number' // the type of the series
    				    )
    				);
    
        return $series;
    }
    add_filter( 'psm-get-chart-series', 'psm_filter_charts_series', 10, 3 );
    
    ShortCode:
    [visualizer id="91" series="psm-get-chart-series" data="psm-get-chart-data"]

Viewing 2 replies - 1 through 2 (of 2 total)