Skip to content

Specified colors do not work on bar charts #2183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wmelnick-cmeonline opened this issue Jun 23, 2021 · 1 comment
Closed

Specified colors do not work on bar charts #2183

wmelnick-cmeonline opened this issue Jun 23, 2021 · 1 comment
Labels

Comments

@wmelnick-cmeonline
Copy link

This is:

- [X] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

Colors specified for bar chart work like they do for donut chart

What is the current behavior?

Default style colors show

What are the steps to reproduce?

Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:

<?php

require __DIR__ . '/vendor/autoload.php';

// Create new Spreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();

// add code that show the issue here...
$colors = [ '00ff00', 'cfcfcf', '007f00' ];
$dataSeriesValues1 = [
    new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$Z$1:$Z$2', null, 2, [], null, $colors),
];
// Then do the rest to create the DataSeries and then the Chart.
// with DataSeries::TYPE_DONUTCHART the chart colors match what is sent.
// with DataSeries::TYPE_BARCHART the chart colors are always the style colors.

Which versions of PhpSpreadsheet and PHP are affected?

php 7.2, current PhpSpreadsheet

@oleibman
Copy link
Collaborator

Should be solved by #2906, which is part of just released 1.24.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants