Support `#N/A` values in charts

FIX #50
This commit is contained in:
Adrien Crivelli 2016-12-03 10:49:03 +09:00
parent 268fc1a4c4
commit 854f7e838d
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
1 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,8 @@
namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx; namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
/** /**
* Copyright (c) 2006 - 2016 PhpSpreadsheet * Copyright (c) 2006 - 2016 PhpSpreadsheet
* *
@ -345,6 +347,8 @@ class Chart
$pointVal = self::getAttribute($seriesValue, 'idx', 'integer'); $pointVal = self::getAttribute($seriesValue, 'idx', 'integer');
if ($dataType == 's') { if ($dataType == 's') {
$seriesVal[$pointVal] = (string) $seriesValue->v; $seriesVal[$pointVal] = (string) $seriesValue->v;
} elseif ($seriesValue->v === Functions::NA()) {
$seriesVal[$pointVal] = null;
} else { } else {
$seriesVal[$pointVal] = (float) $seriesValue->v; $seriesVal[$pointVal] = (float) $seriesValue->v;
} }
@ -378,6 +382,8 @@ class Chart
$pointVal = self::getAttribute($seriesValue, 'idx', 'integer'); $pointVal = self::getAttribute($seriesValue, 'idx', 'integer');
if ($dataType == 's') { if ($dataType == 's') {
$seriesVal[$pointVal][] = (string) $seriesValue->v; $seriesVal[$pointVal][] = (string) $seriesValue->v;
} elseif ($seriesValue->v === Functions::NA()) {
$seriesVal[$pointVal] = null;
} else { } else {
$seriesVal[$pointVal][] = (float) $seriesValue->v; $seriesVal[$pointVal][] = (float) $seriesValue->v;
} }