KoolReport's Forum

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

Barchart height attribute #303

Open Michal opened this topic on on Jun 4, 2018 - 3 comments

Michal commented on Jun 4, 2018

hello there!

Is there any way to set the height of the barchart with various data amount? Sometimes i have to draw chart with 5 bars and other time i have to use same chart for 200 bars. I know the property in:

BarChart::create(array(
    "dataStore"=>$this->dataStore('realizations'),
    "width"=>"100%",
    "height"=>"2000px",
    "columns"=>array(
        "NAME"=>array(

but it's kid of "static" value. I need it to be dynamic. Maybe some bar height? The % values also doesn't work. Have you got any ideas?

KoolReport commented on Jun 4, 2018

You can check the number of bars before creating the chart:

<?php

$number_of_bars = $this->dataStore("relisation")->countData();
$height = "2000px";

//Now base on the number of bars above, please do some code here to change the height, then later you can create the BarChart:

BarChart::create(array(
    "dataStore"=>$this->dataStore('realizations'),
    "width"=>"100%",
    "height"=>$height,
    "columns"=>array(
        "NAME"=>array(
    ...
sneha narnaware commented on Aug 6, 2018

can we set column width

David Winterburn commented on Aug 10, 2018

Hi sneha narnaware,

If you don't mind, please create a new thread for the Google Chart's column width problem. It kind of allows the forum's users to follow issues easier. Thanks!

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