Skip to content
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

Hide Axis #1447

Closed
wants to merge 5 commits into from
Closed

Hide Axis #1447

wants to merge 5 commits into from

Conversation

cwolcott
Copy link

@cwolcott cwolcott commented Apr 17, 2020

Allows developer to hide an axis fully (by default it is shown).

This is:

- [ ] a bugfix
- [X] a new feature

Checklist:

Why this change is needed?

Issue #1446

Allows the developer to fully hide a chart axis. Chart.php currently hardcodes axis to always be displayed.

    $objWriter->startElement('c:delete');
    $objWriter->writeAttribute('val', 0);
    $objWriter->endElement();

The updated code asks the axis if it is visible.

// Inside the writeCategoryAxis method
$objWriter->startElement('c:delete');
$objWriter->writeAttribute('val', $yAxis ? $yAxis->getAxisVisibilty() : 0);
$objWriter->endElement();

// Inside the writeValueAxis method
$objWriter->startElement('c:delete');
$objWriter->writeAttribute('val', $xAxis ? $xAxis->getAxisVisibilty() : 0);
$objWriter->endElement();

This is my first time submitting a pull request for PhpSpreadsheet. I have several more I would like to provide. Any suggestions to make the process smoother on both are ends would be appreciated.

Allows developer to hide an axis fully (by default it is shown).
Correct code styling
Code styling
No need to test if property exists it is always an Axis type
@cwolcott
Copy link
Author

Please help. The Scrutinizer failed because of - scrutinizer.test_coverage, < 0 # Code Coverage decreased from previous inspection by 0.011%.

Can someone let me know what I need to do to get this pass the check.

@oleibman
Copy link
Collaborator

I think you've added two new methods, but haven't added any tests which exercise them, which is why Code Coverage has decreased.

Copy link
Member

@PowerKiKi PowerKiKi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep simpler getter/setter here, so getAxisVisibilty and setAxisVisibilty (insted of showAxis/hideAxis). Both methods should use boolean instead of int.

Also the reader should be updated to be able to read that new property.

@stale
Copy link

stale bot commented Aug 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

@stale stale bot added the stale label Aug 1, 2020
@stale stale bot closed this Aug 8, 2020
@oleibman
Copy link
Collaborator

Equivalent functionality was added by PR #2950 in July 2022.

@oleibman oleibman removed the stale label Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants