KoolReport's Forum

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

Gauge Chart Not Display #505

Open Mazmur opened this topic on on Oct 30, 2018 - 28 comments

Mazmur commented on Oct 30, 2018

Dear Koolreport,

Why My Gauge Chart not display ?

I'm already check the guage.php ini widgets/google folder and is't empty.

Help me please.

Regards, Mazmur

David Winterburn commented on Oct 30, 2018

Hi Mazmur,

A chart needs a correct data structure to display. For us to help you, please post your report's php code, a sample of your data and a link to your page (if possible). Thanks!

Mazmur commented on Oct 30, 2018

Hi David,

Look my script below (real take from koolreport example ) :

 <?php
		Gauge::create(array(
			"title"=>"Sale Report on Stack",
			"dataSource"=>array(
				array("label"=>"Memory","value"=>80)
			)
		));
?>
David Winterburn commented on Oct 30, 2018

Hi Mazmur,

It seems your code runs and displays well in our environment. Maybe it's a resource (javascript) loading issue. Would you please add this method to your report class file:

class myReport extends koolreport\KoolReport
{
  function settings()
  {
    return array(
      "assets" => array(
        "path" => $pathToYourPublicResourceFolder
      ),
    );
  }
...
}

Thanks!

Mazmur commented on Oct 30, 2018

Hi David,

I'm already setting function below : function settings()

{
    $config = include APPPATH."/reports/config.php";
    return array(
        "dataSources"=>array(
            "mgi"=>$config["mgi"]
        )
    );
	return array(
        "assets"=>array(
            "path"=>"../../assets",
            "url"=>"assets",
        ),
        "dataSources"=>array(
            "mgi"=>$config["mgi"]
        )
    );
}

I'm running in Codeigniter. Some file will be move to asset folder (.js) ?

Mazmur commented on Oct 30, 2018

Dear David,

May I look your gauge.php file ?

Because I'm already check the guage.php ini widgets/google folder and is't empty.

Regards

Mazmur commented on Oct 30, 2018

Where I get KoolReport v3.0.0 ?

David Winterburn commented on Oct 30, 2018

Hi Mazmur,

I think the code should be:

{
    $config = include APPPATH."/reports/config.php";

	return array(
        "assets"=>array(
            "path"=>"../../assets",
            "url"=>"assets",
        ),
        "dataSources"=>array(
            "mgi"=>$config["mgi"]
        )
    );
}

Please try this and let us know the result.

The file Gauge.php is indeed empty as it inherits all of its properties and methods from Chart.php. We only use it for its class name Gauge.

KoolReport 3.0 will be released soon but I think your chart's not displaying is because of chart's js file not loading. Thanks!

KoolReport commented on Oct 30, 2018

Could you please paste this into the Gauge.php:

class Gauge extends Chart
{
	protected $stability="current";
	protected $package="gauge";
}

Google Chart changes Gauge library settings so it needs updated. We are about to release the version 3.0.0.

Mazmur commented on Oct 30, 2018

Nice,

Thank you Koolreport. Gauge chart display now.

How can I change this code (from array datasource to query datasource) ? :

                         <?php
			Gauge::create(array(
				"dataSource"=>array(
					array("label"=>"Printing 1","value"=>80)
				)
			));
			?>

Regards.

KoolReport commented on Oct 30, 2018

If you have data store, you can do:

"dataSource"=>$this->dataStore("mydata");

or you can put directly:

"dataSource"=>$this->src("mydatasource")->query("select ... ")
Mazmur commented on Oct 30, 2018

How can I create label and value ? when I use : "dataSource"=>$this->dataStore("mydata");

KoolReport commented on Oct 30, 2018

It should be:

Gauge::create(array(
    "dataSource"=>$this->dataStore("mydata"),
    "columns"=>array(
        "your_label_column_name",
        "your_value_column_name"
    )
))
Mazmur commented on Oct 30, 2018

Very Nice,

How can I configuration gauge chart size ?

Regards.

KoolReport commented on Oct 30, 2018

There are "width" and "height" property which you may set size in pixel or percentage:

"width"=>"200px"

Mazmur commented on Oct 30, 2018

Thank you very much Koolreport. My Gauge Chart it's OK.

KoolReport commented on Oct 30, 2018

Wow, it looks great!

corkperu commented on Jan 28, 2019

Good day!, i'm also having problems with the visualization with Gauge. I'm building a page mixing a lot of reports "Multiple Data Filters", "ColumnChart", "DonutChart", etc. But when i want to add Gauge it simply appear Blank, all the other Columns, Donut, etc appear just fine, Gauge doesn't, no error or anything, just blank. My data structure is also fine because if i make a Gauge report on a separate file just by itself shows just fine. So what's wrong so i can mix these all together?

Note: I read the entire topic so i alredy tried looking into Gauge.php and using a simple example like Mazmur's code

KoolReport commented on Jan 28, 2019

Let do simply test: remove other charts one by one to find out the issue if you suspect other chart may affect Gauge. Since you have number of charts in a page, make sure they have different names (in case you use name for each charts).

corkperu commented on Jan 29, 2019

Greetings!, as you mentioned i did the test disabling the other reports 1 by 1 and the results are:

Gauge + Column = Visible only Column Gauge + Donut = Visible only Donut Gauge Alone = Visible

Also created a new page just having a simply Gauge and Column chart with plain values and whoever is at top will be the only one visible

KoolReport commented on Jan 29, 2019

Thank you! I will let the dev.team know and investigate the issue.

KoolReport commented on Feb 2, 2019

Just to keep you update that due to google change in loader method so it affects our library. We have successful updated our library to get multiple chart loading as normal. The new version of KoolReport will be released soon.

KoolReport commented on Feb 13, 2019

@corkperu: Please download new version of KoolReport, multiple charts problem has been solved.

benoit commented on Apr 1, 2019

Hi Koolreport

I just bought KoolReport Pro and it's a really interesting tool. However, I have some difficulty with the googl gauge chart.

My first gauge works with datasource and array. The second one works with datasource, datastorel.

The first one works, however, the second one does not appear. This is the code

Can anyone help me?

<!-- GAUGE 1 WITH DATASOURCE  -> ARRAY - OK-->					
	<?php
    Gauge::create(array(
        "title"=>"Conductvité",     
        "dataSource"=>array(
            array("obj"=>"","condS"=>29),
			),     
         "columns"=>array(
            "obj",
            "condS"=>array(
                "suffix"=>" ms",   
					)
				), 			  
       "options"=>array(
			"minorTicks"=> 10
			),
       "width"=>"200px",
       "height"=>"200px",  
	));
    ?>

<!-- GAUGE 2 WITH DATASOURCE -> DATASTOE (MYSQL) - DONT APPEAR-->						
	<?php
    Gauge::create(array(
        "title"=>"Conductvité",
		"dataSource"=>$this->dataStore('result_0'),   
         "columns"=>array(
            "obj",
            "condS"=>array(
                "suffix"=>"ms",   
					)
				),
		"options"=>array(
			"minorTicks"=> 10
			),
       "width"=>"200px",
       "height"=>"200px",        
		));
    ?>

<!-- TABLE  WITH DATASOURCE -> DATASTOE (MYSQL) - OK -->	
   <?php
    Table::create(array(
        "dataSource"=>$this->dataStore('result_0'),
        "columns"=>array(
            "obj"=>array(
                "label"=>"Objet",
                "type"=>"varchar",
            ),
            "cond_s"=>array(
                "label"=>"Millisiemens",
                "type"=>"number",
            ),           
        ),
        ))
    ?>

KoolReport commented on Apr 1, 2019

Hi,

we do not have the "type"=>"varchar", please change it to "type"=>"string",

Let me know if it works

benoit commented on Apr 1, 2019

Thank you for the quick answer. I just made the modification. But that doesn't solve my problem.

KoolReport commented on Apr 1, 2019

In the second chart, you do this:

"condS"=>array(
    "type"=>"number"
    "suffix"=>"ms",   
)
benoit commented on Apr 1, 2019

it work's thank you very much

KoolReport commented on Apr 1, 2019

Awesome!

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
help needed
solved

None