KoolReport's Forum

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

Adding dynamic data to x-axis and changing width of the column bar #1622

Open Arun Galgali opened this topic on on Sep 17, 2020 - 5 comments

Arun Galgali commented on Sep 17, 2020

I have to show "Truck Id" dynamic data in x-axis but for single data the bar shows more width rather than on the particluar number and it is should display on number 7 correctly. can anyone help me out because i'm new to this plugin ColumnChart::create(array(

        "dataStore"=>$this->dataStore('sales_by_truck'),
        "width"=>"100%",
        "height"=>"500px",
        "columns"=>array(
            "TruckId"=>array(
                "type"=>"number",
                "label"=>"TruckId"
            ),
            "InvoiceAmount"=>array(
                "type"=>"number",
                "label"=>"InvoiceAmount",
                "prefix"=>"$",
                "emphasis"=>true
            )
        ),
        "options"=>array(
            "title"=>"Sales By Truck(Bar Chart)",
            "barThickness"=>100
        )
    ));

David Winterburn commented on Sep 18, 2020

Please let us know which chart package you are using, is it Google chart, Chartjs, C3 chart or others?

Arun Galgali commented on Sep 18, 2020

Google Chart

Arun Galgali commented on Sep 18, 2020

Even I need to display dynamic number rather than these 6.0 or 6.2 and remove decimal point

David Winterburn commented on Sep 18, 2020

Please try options->bar->groupWidth property like this:

    ColumnChart::create(array(
        ...
        "options" => array(
            "bar" => array(
                "groupWidth" => $width, //in px or %
            )
        )
    ));

As for your category TruckId, please set its type = "string" instead of number for the chart to show Id instead of continuous float values. Let us know if there's still any issue. Thanks!

Arun Galgali commented on Sep 18, 2020

if truck_id is adding more than one then it should show in one bar instead of coming saperately after adding typ="string"

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