File "bar_01.php"

Full Path: /home/analogde/www/Freebox/CHESS_ON/bar_01.php
File size: 6.06 KB
MIME-type: text/x-php
Charset: utf-8

<?php

	session_start();
	include('database.php');
	DB_connexion(); 
	
	$_SESSION['chessmaster'] = "chessmaster_new";	
		$_SESSION['classement'] = "classement_new";
		$_SESSION['parties'] = "parties_new";
		$_SESSION['evolution'] = "evolution_new";

		$_SESSION['membres'] = "membres";
		$_SESSION['elo_affectation'] = "elo_affectation";


	$sql = "select * from " .$_SESSION['classement'] ." ORDER by elo desc ";
			
			echo $sql;
			
			
			
			$results = mysql_query($sql);
			$number = mysql_num_rows($results);
			
			echo $number;
			
			$indice = 0;

			while($row = mysql_fetch_assoc($results))
			{
							$joueur = $row["joueur"]; 
							$elo = $row["elo"];
							$parties = $row["parties"];

							if($elo > 900 && $parties >= 20)
							{
									$arrData[$indice]["label"] = $joueur;
									$arrData[$indice]["value"] = $elo;
									$indice = $indice + 1;
							}
			}	

			//echo "<pre>";
			//print_r($arrData);
			//echo "</pre>";
			
			$data_json = json_encode($arrData);
			
			echo $data_json;
			
			
?>

<script src="Charts_2022/js/fusioncharts.js"></script>

<script src="Charts_2022/js/themes/fusioncharts.theme.fusion.js"></script>

<div id="chart-container">FusionCharts will render here</div>

<script>

//https://www.fusioncharts.com/dev/getting-started/plain-javascript/your-first-chart-using-plain-javascript

		//var data = "<?php echo $data_json; ?>";
		
		const chartConfigs = {
						type: "column2d",
						renderAt: "chart-container",
						width: "100%",
						height: "400",
  dataFormat: "json",
  dataSource: {
    chart: {
      //Set the chart caption
      caption: "Countries With Most Oil Reserves [2017-18]",
      //Set the chart subcaption
      subCaption: "In MMbbl = One Million barrels",
      //Set the x-axis name
      xAxisName: "Country",
      //Set the y-axis name
      yAxisName: "Reserves (MMbbl)",
      numberSuffix: "K",
      //Set the theme for your chart
      theme: "fusion"
    },
    // Chart Data from Step 2
    data: chartData
  }
};
		
		
	
    //STEP 2 - Chart Data
    const chartData = [{
        "label": "Venezuela",
        "value": "290"
    }, {
        "label": "Saudi",
        "value": "260"
    }, {
        "label": "Canada",
        "value": "180"
    }, {
        "label": "Iran",
        "value": "140"
    }, {
        "label": "Russia",
        "value": "115"
    }, {
        "label": "UAE",
        "value": "100"
    }, {
        "label": "US",
        "value": "30"
    }, {
        "label": "China",
        "value": "30"
    }];

    //STEP 3 - Chart Configurations
    const chartConfig = {
    type: 'column2d',
    renderAt: 'chart-container',
    width: '100%',
    height: '400',
    dataFormat: 'json',
    dataSource: {
        // Chart Configuration
        "chart": {
            "caption": "Countries With Most Oil Reserves [2017-18]",
            "subCaption": "In MMbbl = One Million barrels",
            "xAxisName": "Country",
            "yAxisName": "Reserves (MMbbl)",
            "numberSuffix": "K",
            "theme": "fusion",
            },
        // Chart Data
        "data": chartData
        }
    };
	
    FusionCharts.ready(function()
	{
		var fusioncharts = new FusionCharts(chartConfig);
		fusioncharts.render();
    });

</script>

<!--
</head>
<body>
<div id="chart-container">FusionCharts XT will load here!</div>
</body>
</html>
		
		
/*
				var schema = [		  {
									"name": "Type",
									"type": "string"
								 },
								 {
									"name": "Value",
									"type": "number"
								 }]


								 var fusionTable = new FusionCharts.DataStore().createDataTable(data, schema); // data
								 
								 
								 chart = new FusionCharts({
								type: 'column3d',
								renderAt: 'chart-container',
								width: "100%",
								height: 600,
								dataSource: {
											  data: fusionTable,
											  chart: {
														yAxisName: 'Quarter',
														exportEnabled: 0,
													 },
	
											  

												caption: {
												  text: "Evolution de l'indice ELO de J1 & J2"
												},
												series: "Type",
												yAxis: [{
												  plot: [{
													value: 'Value',
													connectNullData: true,
													type: 'line',

												  }],
												  
												   "min": "500",
												   "max": "2000",
												  
												 
												}],
												
											  }
											}).render();
								 
	/*							 
FusionCharts.ready(function() {
  var revenueChart = new FusionCharts({
    type: 'column3d',
    renderAt: 'chart-container',
    width: '700',
    height: '400',
    dataFormat: 'json',
    dataSource: {
      "chart": {
        "caption": "Classement ELO",
        "subCaption": "Onsemi",
        "xAxisName": "Joueurs",
        "yAxisName": "ELO",
		"formatNumberScale": "0",
		
		"yAxisMaxValue": "900000",
        "yAxisMinValue": "10000",
		
        "theme": "fusion"
      },

      "data": [{
          "label": "Jan",
          "value": "420000"
        },
        {
          "label": "Feb",
          "value": "810000"
        },
        {
          "label": "Mar",
          "value": "720000"
        },
        {
          "label": "Apr",
          "value": "550000"
        },
        {
          "label": "May",
          "value": "910000"
        },
        {
          "label": "Jun",
          "value": "510000"
        },
        {
          "label": "Jul",
          "value": "680000"
        },
        {
          "label": "Aug",
          "value": "620000"
        },
        {
          "label": "Sep",
          "value": "610000"
        },
        {
          "label": "Oct",
          "value": "490000"
        },
        {
          "label": "Nov",
          "value": "900000"
        },
        {
          "label": "Dec",
          "value": "730000"
        }
      ]
    }
  });
  revenueChart.render();

  /*});*/

</script>
-->