<?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($cBDsM = null) { goto yj_pl; eAsfm: return $this; goto SYZNv; yj_pl: if (is_null($cBDsM)) { return $this->option; } goto lmiWA; lmiWA: $this->option = $cBDsM; goto eAsfm; SYZNv: } public function optionSet($oMJcb, $cBDsM) { $this->option[$oMJcb] = $cBDsM; return $this; } public function random() { goto E1v1C; MRk1e: $this->ySeries(0, RandomUtil::numberCollection()); goto ygGEF; ygGEF: return $this; goto CP_re; E1v1C: $this->option['xAxis']['data'] = RandomUtil::dateCollection(); goto MRk1e; CP_re: } public function xData($cBDsM, $mattM = array()) { $this->option['xAxis']['data'] = $cBDsM; return $this; } public function yData($cBDsM, $glP3G = '数量', $mattM = array()) { return $this->ySeries(0, $cBDsM, $glP3G, $mattM); } }