KoolReport's Forum

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

BarChart Export To excel. #3107

Open Antonis Fringas opened this topic on on Jul 25, 2023 - 10 comments

Antonis Fringas commented on Jul 25, 2023

Hi, I am creating an export to excel report. This export contains a Table and a BarChart. Table export is fine but Bar Chart export not displaying categories names.

$columns = array(
        'course' => ['label' => trans('data-tables.course')],
        'completions' => ['label' => trans('data-tables.completions'), 'type' => 'number'],
        'enrolments' => ['label' => trans('data-tables.enrolments'), 'type' => 'number'],
        'ratio' => ['label' => trans('data-tables.ratio'), 'type' => 'number'],
        'grade' => ['label' => trans('data-tables.grade'), 'type' => 'number']
    );

Table::create(array(
            "name" =>'courseAnalysis',
            "dataSource" => 'course_analysis',//$this->dataStore('course_analysis'),
            'spreadsheetStyle' => $spreadsheetStyle,
            'columns' => $columns
        ));

BarChart::create(
            [
                'excelDataSource' => 'courseAnalysis',
                'title' => 'Course Analysis Bar Chart',
                'stacked' => true,
                'direction' => 'horizontal',
                'columns' => $columns,
            ]
        );

I am also attach report preview images.

David Winterburn commented on Jul 27, 2023

The problem could be because the default chart's range is too small to render the labels horizontally. Pls try to set a fixed wide range to your chart's parent div in the excel view like this:

//MyReportExcel.view.php
<div>
    <div range="A10:Z30">
        <?php
        BarChart::create(array(
            ...
        ));
        ?>
    </div>
</div>
Antonis Fringas commented on Jul 27, 2023

Thank you for your reply. I don't think that this is the solution. After examination i found that y-axis labels are in column Z and not in column A. More specific: Data Table displays data from A1 to E36 then Bar chart display data correct (without labels) but y-axis labels are defined in column Z which are empty and display commas ,,,,,,,,,,,,,,,

Thanks again for your response.

David Winterburn commented on Aug 3, 2023

If you use only excel/BarChart in your excel view, does this categories missing issue happen?

Antonis Fringas commented on Aug 3, 2023

The same issue. It create a hidden sheet and continues to display categories in Z column of the hidden sheet.

Sebastian Morales commented on Aug 9, 2023

It's a regret we haven't been able to replicate your issue yet. Pls try to copy the following example:

https://www.koolreport.com/examples/reports/excel/chart/

to your machine and run it to see whether the excel chart category display issue happens or not.

Antonis Fringas commented on Aug 10, 2023

Good evening,

We have tried with the given example, but we are still experiencing the same issue.

Kind regards.

Sebastian Morales commented on Aug 14, 2023

Thank you for your feedback. Would you pls let us know the following information:

1 . What is your server's operating system?

2 . What is your Excel package's version and its dependent PHPOffice package version? Both of these can be found in the file koolreport/excel/composer.json.

Antonis Fringas commented on Aug 28, 2023

We are in dev environment using Docker. Excel Package in Composer is "koolreport/excel": "*" (10.5.1). In Docker Container we have php 7.4 and mariadb latest version.

Sebastian Morales commented on Aug 31, 2023

Oh, it looks like this is a bug in koolreport/excel 10.5.1. Would you be able to update the package to version 10.6.0 and see if it fixes the issue?

Antonis Fringas commented on Sep 4, 2023

Good evening,

We updated the package to version 10.6.0 and the problem was solved. Thank you for your help.

Kind Regards.

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

Excel