Пример #1
0
 public function testTooltip()
 {
     $tooltip = new Tooltip(['formatter' => new JsExpression('function(){ return \'<b>\' + this.series.name + \'</b><br/>\' + this.x + \': +\' + this.y; }')]);
     $this->assertEquals('{"formatter":function(){ return \'<b>\' + this.series.name + \'</b><br/>\' + this.x + \': +\' + this.y; }}', $tooltip->toJson());
     $tooltip = new Tooltip();
     $tooltip->setPointFormat('{series.name}: <b>{point.y}</b><br/>');
     $tooltip->setValueSuffix(' cm');
     $tooltip->setShared(true);
     $this->assertEquals('{"pointFormat":"{series.name}: <b>{point.y}</b><br/>","valueSuffix":" cm","shared":true}', $tooltip->toJson());
 }
Пример #2
0
 /**
  *
  */
 public function testTooltip()
 {
     $expected = $this->getExpected();
     $model = new Tooltip();
     $model->setAnimation($expected['animation']);
     $model->setBackgroundColor($expected['backgroundColor']);
     $model->setBorderColor($expected['borderColor']);
     $model->setBorderRadius($expected['borderRadius']);
     $model->setCrosshairs($expected['crosshairs']);
     $model->setEnabled($expected['enabled']);
     $model->setFormatter($expected['formatter']);
     $model->setPositioner($expected['positioner']);
     $model->setShadow($expected['shadow']);
     $model->setShape($expected['shape']);
     $model->setShared($expected['shared']);
     $model->setSnap($expected['snap']);
     $model->setStyle($expected['style']);
     $model->setUseHTML($expected['useHTML']);
     $optionsProperty = $this->getPrivateProperty('options');
     $this->assertEquals($expected, $optionsProperty->getValue($model));
     unset($model);
     $model = new Tooltip($expected);
     $this->assertEquals($expected['animation'], $model->isAnimation());
     $this->assertEquals($expected['backgroundColor'], $model->getBackgroundColor());
     $this->assertEquals($expected['borderColor'], $model->getBorderColor());
     $this->assertEquals($expected['borderRadius'], $model->getBorderRadius());
     $this->assertEquals($expected['crosshairs'], $model->isCrosshairs());
     $this->assertEquals($expected['enabled'], $model->isEnabled());
     $this->assertEquals($expected['formatter'], $model->getFormatter());
     $this->assertEquals($expected['positioner'], $model->getPositioner());
     $this->assertEquals($expected['shadow'], $model->isShadow());
     $this->assertEquals($expected['shape'], $model->getShape());
     $this->assertEquals($expected['shared'], $model->isShared());
     $this->assertEquals($expected['snap'], $model->getSnap());
     $this->assertEquals($expected['style'], $model->getStyle());
     $this->assertEquals($expected['useHTML'], $model->isUseHTML());
     unset($model);
     $model = new Tooltip();
     $model->disable();
     $this->assertEquals(false, $model->enabled);
 }