Location: PHPKode > scripts > Traffic Analyzer > trafficanalyzer/js/ta_jqplot_loader.js.php
<?php 
		if(!function_exists('add_action')){
	    	require_once("../../../../wp-config.php");
	    }
		include '../config.php';

	   ?>

<?php 
	global $current_user;
	$post_loaded_script_path = plugins_url("/",__FILE__);
	
	
	if(is_active_widget(false,false,'ta_trend',true))
		$trend_widget='yes';
	else 
		$trend_widget='no';
		
	if(is_active_widget(false,false,'ta_visits',true))
		$visit_widget='yes';
	else 
		$visit_widget='no';

		$server_data[0] = get_option('ta_no_of_days');	 	// No of days
		$server_data[1] = get_option('ta_xaxis');	 		// show or hide x-axis labels
		$server_data[2] = get_option('ta_trend_powered');	// show powered for trend widget
		$server_data[3] = get_option('ta_visit_powered');	// show powered for visit widget
		
		if(empty($server_data[0]))
			$server_data[0] = 4;
			
		if(empty($server_data[1]))
			$server_data[1] = 0;
			
		if(empty($server_data[2]))
			$server_data[2] = 0;
			
		if(empty($server_data[3]))
			$server_data[3] = 0;
		
?>



jQuery(document).ready(function(){								
								
								
								<?php									
									if($trend_widget=='no' || $server_data[2]=='1' ) {																
								?>
									jQuery('#wpta_trend').hide();								
								<?php 
									}
								?>
								
								
								<?php 
									if($visit_widget=='no' || $server_data[3] =='1'){																
								?>
									jQuery('#wpta_powered').hide();								
								<?php 
									}
								?>								
								
								
                                <?php 
                                	global $wpdb;
                                	$sql  = " select date_format(dt,'%d-%M-%Y') as dt ,count(ip) cnt from ( select date(vtime) as dt ,count(ip) as ip ";
                                	$sql .= " from wp_tanalyzer_visits ";
                                	$sql .= " where 1=1" ;

                                	
                                	$sql .= ta_user_agent_where();
                                	$sql .= "group by date(vtime),ip,user_agent,wpta_cookie ) as t ";
                                	$sql .= " where dt between date_sub(current_date(), interval $server_data[0] day) and current_date() ";
									
									$sql .= " group by dt ";
									$sql .= " order by dt asc ";
									
									$result = $wpdb->get_results($sql);
									$data_array=array();
									foreach($result as $row){								
										$dt = date('d-M-y', strtotime($row->dt));
										$data_array[] = "['".$dt."',".$row->cnt."]";
									}
									
									if(is_array($data_array)){
										$data_string = implode(',',$data_array);
									}else 	
										$data_string = "";
										
									$data_string = "[".$data_string."]";
									
								
                                ?>                                
                                
                                
                                
                                var d3 = <?php echo $data_string ; ?>;
                                
                                if(d3.length>0){
                                
                                
                                if(jQuery('#trenddiv').length>0){
                                
                                jQuery.jqplot('trenddiv',  [d3],
                                                {
                                                        animate:true,
                                                        
                                                        axes : {
                                                                xaxis:{
                                                                        renderer: jQuery.jqplot.DateAxisRenderer,
                                                                        labelRenderer:jQuery.jqplot.CanvasAxisLabelRenderer,
                                                                        tickRenderer:jQuery.jqplot.CanvasAxisTickRenderer,
                                                                        tickOptions: {
                                                                                        formatString:'%d %b %y',
                                                                                        show:true,
                                                                                        angle:-20
                                                                        },
                                                                        showTicks:<?php echo ($server_data[1]=="1"?"true":"false"); ?>,
                                                                        showTickMarks:true
                                                                },
                                                                yaxis:{
                                                             
                                                                	tickOptions:{
                                                                		show:true
                                                                	},
                                                                	showTicks:true,
                                                                	showTickMarks:true,
                                                                	//label:'Visitors',
                                                                	//labelRenderer:jQuery.jqplot.CanvasAxisLabelRenderer
                                                                	
                                                                		
                                                                }

                                                        },
                                                        highlighter: {
   		
                                                                show: true,
                                                                tooltipLocation : 'sw',
                                                                formatString : '<table class="jqplot-highlighter"><tr><td>Date</td><td>%s</td></tr><tr><td>Visitors</td><td>%d</td></tr></table>'
                                                        }
                                                        
                                                }

                                          );
                                          
                                          }
                                         }else{
                                         	jQuery('#trenddiv').html("No Data Found");
                                         }
                        }
                );
Return current item: Traffic Analyzer