PhpOffice\PhpPresentation\Shape\Chart\Series::addValue PHP Method

addValue() public method

Add Value
public addValue ( mixed $key, mixed $value ) : Series
$key mixed
$value mixed
return Series
    public function addValue($key, $value)
    {
        $this->values[$key] = $value;
        return $this;
    }

Usage Example

示例#1
0
 public function testValue()
 {
     $object = new Series();
     $array = array('0' => 'a', '1' => 'b', '2' => 'c', '3' => 'd');
     $this->assertInternalType('array', $object->getValues());
     $this->assertEmpty($object->getValues());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setValues());
     $this->assertEmpty($object->getValues());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setValues($array));
     $this->assertCount(count($array), $object->getValues());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->addValue(4, 'e'));
     $this->assertCount(count($array) + 1, $object->getValues());
 }