KoolReport's Forum

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

ColumnChart values are not shows liner manner for columns #408

Open mike opened this topic on on Aug 7, 2018 - 3 comments

mike commented on Aug 7, 2018
<?php 
        ColumnChart::create(array(
        "dataStore"=>$this->dataStore('report_byNet'),
        "width"=>"100%",
       "columns"=>array(
				"sale"=>array(
				    
				),
				"sale_total_usd"=>array(
				    "type"=>"number",
					"annotation"=>function($row)
					{
						if($row["sale_total_usd"]==''){
						$row='';
						
					}else{
						$row= "USD $".$row["sale_total_usd"];
					}
					return $row;
					
						
					},
				),
				"sale_total_cad"=>array(
				  "type"=>"number",
					"annotation"=>function($row)
					{
						if($row["sale_total_cad"]==''){
						$row='';
						
					}else{
						$row= "CAD $".$row["sale_total_cad"];
					}
					return $row;
						
					},
				),"Total"=>array(
				    "type"=>"number",
					"annotation"=>function($row)
					{ 
					    if($row["Total"]==''){
						$row='';
						
					}else{
						$row= "Total $".$row["Total"];
					}
					return $row;
						
					},
				),
			),
        "options"=>array(
			"legend"=>array(
			"position"=>"bottom",
			),
			"chartArea"=>array(
			"width"=>"80%",
			),
			"bar"=>array(
			"groupWidth"=>"40%",
			),
			"annotations"=>array(
			    "alwaysOutside"=>true,
			),
        )
    ));
        ?>

Total column value is not shows up like others column......

KoolReport commented on Aug 7, 2018

That seems strange. If you change the orders of columns, does the issue persist?

mike commented on Aug 8, 2018

no ....only that column not shows annotations outside values....

David Winterburn commented on Aug 10, 2018

Hi Mike,

It seems annotations' alwaysOutside is not honored 100% of the case. One of the reason maybe as quoted from StackOverflow:

"Charts seems to be auto-sizing the vertical axis to leave enough room for the tallest bar, but not for the annotation above it, even though you specified alwaysOutside: true.

One solution would be to set the vertical ticks explicitly. This makes Charts leave more room at the top, and then it fits the annotation above it. Here's a version of the code you linked that adds these "ticks" "

You could check their code at this thread and see if it applies to your case: https://stackoverflow.com/questions/42978446/google-column-chart-outside-didnt-work/42978814

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