Как установить цвет линии в файле вывода диаграммы Excel с помощью phpspreadsheets - PullRequest
0 голосов
/ 10 мая 2019

■ ожидаемое поведение output вывод линейной диаграммы в файл excel с линией цвета настраивается кодом в линейной диаграмме

■ Каково текущее поведение?・ Цвет линии не настраивается кодом в линейной диаграмме, но пример кода не работает

$dataSeriesLineLabels = [
            new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1, [], null, '008000'), // Temperature
            new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1, [], null, '0000FF'), // Rainfall
            new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1, [], null, '008000'), // Humidity
        ];

        $dataSeriesLineValues = [
            new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4), // Temperature
            new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), // Rainfall
            new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4), // Humidity
        ];

        // Build the dataseries
        $seriesLine = new DataSeries(
            DataSeries::TYPE_LINECHART, // plotType
            DataSeries::GROUPING_STACKED, // plotGrouping
            range(0, count($dataSeriesLineValues) - 1), // plotOrder
            $dataSeriesLineLabels, // plotLabel
            $xAxisTickValues, // plotCategory
            $dataSeriesLineValues, // plotValues
            null,
            null,
            DataSeries::STYLE_LINEMARKER
        );

        // Set the series in the plot area
        $plotArea = new PlotArea(null, [$seriesLine]);
        // Set the chart legend
        $legend = new Legend(Legend::POSITION_TOPRIGHT, null, false);
        $title = new Title('Average EndGame');
        // $xAxisLabel = new Title('Financial Period');
        // $yAxisLabel = new Title('Value ($k)');

        // Create the chart
        $chart = new Chart(
            'Average EndGame', // name
            $title, // title
            $legend, // legend
            $plotArea, // plotArea
            true, // plotVisibleOnly
            0, // displayBlanksAs
            null, // xAxisLabel
            null  // yAxisLabel
        );

        // Set the position where the chart should appear in the worksheet
        $chart->setTopLeftPosition('B8');
        $chart->setBottomRightPosition('O25');
...