PHPOffice / PhpSpreadsheet

A pure PHP library for reading and writing spreadsheet files
https://phpspreadsheet.readthedocs.io
MIT License
13.34k stars 3.46k forks source link

Can't hide axis #1446

Closed cwolcott closed 4 years ago

cwolcott commented 4 years ago

This is:

- [] a bug report
- [x] 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?

To be able to fully disable the x and/or y axis from being shown.

What is the current behavior?

Can't be done. Code currently hardcodes axis to always be displayed.

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

What are the steps to reproduce?

There is no api interface to control desired outcome.

Which versions of PhpSpreadsheet and PHP are affected?

1.11.0

I plan to submit a pull request that will allow the developer to hide the axis fully. By default the axis is visible.

    $yAxis = new Axis();
    $yAxis->hideAxis();

Before image

The xl\charts\chart1.xml for the category axis looks like with :

<c:catAx><c:axId val="75091328"/><c:scaling><c:orientation val="minMax"/></c:scaling><c:delete val="0"/><c:axPos val="b"/><c:title><c:tx><c:rich><a:bodyPr/><a:lstStyle/><a:p><a:pPr><a:defRPr sz="1400" b="1"/></a:pPr><a:r><a:rPr lang="en-US" sz="1400" b="1"/><a:t>Assay Wells</a:t></a:r></a:p></c:rich></c:tx><c:overlay val="0"/></c:title><c:numFmt formatCode="General" sourceLinked="1"/><c:majorTickMark val="none"/><c:minorTickMark val="none"/><c:tickLblPos val="low"/><c:crossAx val="75089408"/><c:crosses val="autoZero"/><c:auto val="1"/><c:lblAlgn val="ctr"/><c:lblOffset val="100"/><c:noMultiLvlLbl val="0"/></c:catAx>

After image

The Xlsx/Charts.php will now dynamically generate the delete tag based on the axis configuration.

cwolcott commented 4 years ago

I have submitted a pull request and 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.

stale[bot] commented 4 years ago

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[bot] commented 4 years ago

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.

oleibman commented 3 months ago

Equivalent functionality was added by PR https://github.com/PHPOffice/PhpSpreadsheet/pull/2950 in July 2022.