KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Geo Chart #2213

Open Sylvie Rougnon-Glasson opened this topic on on Jul 19, 2021 - 1 comments

Sylvie Rougnon-Glasson commented on Jul 19, 2021

Bonjour Je n'arrive pas à mettre afficher les résultats de ma requête dans le GEOCHART. Voici mes codes KoolReport_RepondantDansMonde.php____ <?php

Répondants par pays

require_once "load.koolreport.php";

use \koolreport\core\src\processes\CalculatedColumn; use \koolreport\core\src\processes\ColumnMeta; use \koolreport\core\src\KoolReport; use \koolreport\core\src\processes\Custom;

require_once 'config.php'; global $db_host; global $db_database; global $db_user; global $db_pass; $_ENV['DB_HOST']=$db_host; $_ENV['DB_DATABASE']=$db_database; $_ENV['DB_USERNAME']=$db_user; $_ENV['DB_PASSWORD']=$db_pass;

class KoolReport_RepondantDansMonde extends KoolReport { function settings() {

    return array(
      "dataSources"=>array(
	        "automaker"=>array(
	            "connectionString"=>"mysql:host=" . $_ENV['DB_HOST'] . ";dbname=" . $_ENV['DB_DATABASE'],
        		"username"=>$_ENV['DB_USERNAME'],
        		"password"=>$_ENV['DB_PASSWORD'],
	            "charset"=>"utf8"
	        ),
	    )
    );

}

public function setup()
{
    $this->src('automaker')
    ->query("
        SELECT t_pays.LibAnglais as LibPays, Count(DISTINCT IdRepondant) as NbRepondants FROM t_data_koolreport INNER JOIN t_pays ON t_pays.IdPays=t_data_koolreport.Pays GROUP BY LibPays
    ")
    ->pipe($this->dataStore("RepondantParPays"));
}

}

$report = new KoolReport_RepondantDansMonde; $report->run()->render();

__KoolReport_RepondantDansMonde.view.php__ <?php

Répondants par pays

use \koolreport\core\src\widgets\koolphp\Table; use \koolreport\core\src\widgets\google\Map; use \koolreport\inputs\Select2; use \koolreport\core\src\clients\Bootstrap;
use \koolreport\inputs\DateRangePicker;

?> <div class="report-container">

<div class="text-center">
    <h1 style="color:#00659A;font-size:calc(0.32 * 10vmin);font-weight:500">Nombre de répondants par pays</h1>
</div>

<div style="margin-bottom:50px;">
    <?php
    if($this->dataStore("RepondantParPays")->countData()>0){
	    Map::create(
	    	array(
	        	"title"=>"World Polulation 2016",
			    "dataStore"=>$this->datastore("RepondantParPays"),
			    "columns"=>array(
		            "LibPays",
		            "NbRepondants"=>array(
		                "type"=>"number",
		                "label"=>"AA"
		            )
		        ), 
			    "mapsApiKey" => "XXX",
		        "options"=>[
			        "region"=>'IT',
			        "displayMode" => 'markers',
			        "colorAxis" => ["colors"=> ['green', 'blue']]
			    ]   
	        )
	    );
	}else{?>
        <div class="alert alert-warning">
            <i class="glyphicon glyphicon-info-sign"></i> Lo sentimos. No hay datos para mostrar en las fechas seleccionadas.
        </div>
		<?php    
	}?>    
</div>

</div>

Sebastian Morales commented on Jul 21, 2021

Are you able to run KoolReport's GeoChart example on your local server:

https://www.koolreport.com/examples/reports/google_charts/geo_chart/

You could find this example in our KoolReport and Example package or copy this example code to your local server. Tks,

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

None