<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Widget\Chart; use ModStart\Core\Util\RandomUtil; use ModStart\Widget\AbstractWidget; use ModStart\Widget\Traits\DSTrait; class Chart extends AbstractWidget { use DSTrait; protected $view = 'modstart::widget.chart'; protected $height = 300; protected $option = array('grid' => array('right' => '1%', 'left' => '1%', 'bottom' => '10%', 'containLabel' => true), 'toolbox' => array('feature' => array('dataView' => array('show' => true, 'readOnly' => false), 'restore' => array('show' => true), 'saveAsImage' => array('show' => true))), 'tooltip' => array('trigger' => 'axis', 'axisPointer' => array('type' => 'shadow', 'snap' => true, 'crossStyle' => array('color' => '#999'))), 'legend' => array('data' => array()), 'xAxis' => array('type' => 'category', 'data' => array()), 'yAxis' => array('type' => 'value', 'minInterval' => 1), 'series' => array()); public function __construct() { parent::__construct(); } protected function variables() { return array('option' => $this->option, 'height' => $this->height); } public static function make() { return new static(); } public function option($gwXrh = null) { goto bcAo2; RBUbR: $this->option = $gwXrh; goto s3OKm; bcAo2: if (is_null($gwXrh)) { return $this->option; } goto RBUbR; s3OKm: return $this; goto XvTvB; XvTvB: } public function optionSet($rvTrU, $gwXrh) { $this->option[$rvTrU] = $gwXrh; return $this; } public function random() { goto Cp44J; N1duT: $this->ySeries(0, RandomUtil::numberCollection()); goto ncqY0; ncqY0: return $this; goto VuDfU; Cp44J: $this->option['xAxis']['data'] = RandomUtil::dateCollection(); goto N1duT; VuDfU: } public function xData($gwXrh, $zlK8N = array()) { $this->option['xAxis']['data'] = $gwXrh; return $this; } public function yData($gwXrh, $L1g9F = '数量', $zlK8N = array()) { return $this->ySeries(0, $gwXrh, $L1g9F, $zlK8N); } }