Skip to content

Deprecate use of $smoothLine as well as $plotStyle='lineMarker' in Chart/DataSeries for ScatterCharts #2935

Closed
@bridgeplayr

Description

@bridgeplayr

This is:

- [x] 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)

N.B. DataSeries->plotStyle property value STYLE_LINEMARKER (='lineMarker') is currently examined only in Chart/Renderer/JpGraph.php, whose use is deprecated. Otherwise, DataSeries property value 'lineMarker' is unused.

Similarly, the DataSeries->smoothLine property is never tested, but its presence potentially confuses users who mistakenly use this (identically named) property and its (identically named) getter/setter methods in both DataSeries as well as DataSeriesValues.

What is the expected behavior?

When the user assigns the 'smoothLine' property to a DataSeriesValues array [via $DSV->set_smoothLine(true) ] then the Chart line should be displayed as a smooth Bezier line regardless of any property in its DataSeries, (in my opinion).

What is the current behavior?

If DataSeriesValues->smoothLine == TRUE its line will be straight if its DataSeries->plotStyle == 'lineMarker' (regardless of the value of DataSeries->smoothLine,) This is because Chart/Writer/Xlsx qualifies its writing of the <c:smooth> element with a logical AND of '$plotType ===DataSeries::TYPE_SCATTERCHART' and '$plotStyle' === 'smoothMarker'. Therefore, a DataSeriesValues array with a specified property value of TRUE for 'smoothLine' will not be expressed in the xml as <c:smooth val="1"> unless the DataSeries' plotStyle == 'smoothMarker'. Instead, <c:smooth> will be absent from the xml.

What are the steps to reproduce?

In example file samples/Chart/33_Chart_create_scatter2.php, change as follows:
WAS: DataSeries::STYLE_SMOOTHMARKER // plotStyle

  1. IS: DataSeries::STYLE_LINEMARKER // plotStyle
    This changes the original smooth (Bezier) line nature of the first DataSeriesValues series to a straight line point connection (which is the default behavior).

  2. IS: // DataSeries::STYLE_LINEMARKER // plotStyle
    Same result.

Neither result is affected by any value of property DataSeries->smoothLine, including null.

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...

If this is an issue with reading a specific spreadsheet file, then it may be appropriate to provide a sample file that demonstrates the problem; but please keep it as small as possible, and sanitize any confidential information before uploading.

What features do you think are causing the issue

  • Reader
  • Writer
  • Styles
  • Data Validations
  • Formula Calulations
  • Charts
  • AutoFilter
  • Form Elements

Does an issue affect all spreadsheet file formats? If not, which formats are affected?

Xlsx is affected

Which versions of PhpSpreadsheet and PHP are affected?

1.24 7.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions