企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
##### 首页曲线图 ~~~ $iframe->chars_conf(); //>引入JS,只需使用一次 $iframe->chars($charsid,$data,$x,$y,$title=''); ~~~ ##### 必选参数 ~~~ charsid 图标ID data 数据json格式数据 x X轴配置数组,如:['key'=>'值','label'=>'值对应的名字'] y Y轴配置数组,如:['key'=>['值1','值2'],'label'=>['值1对应的名字','值2对应的名字']] ~~~ ##### 可选参数 ~~~ title 图表名称 ~~~ ##### 实例 ~~~ $title = '7天注册/活跃数量'; $charsid= 'seven_sign'; $data = []; for ($i = 7 ; $i > 0 ; $i--){ $sd = $s-($i*86400); $other = []; $other['field'] = ['result','type']; $other['where'] = ['type in(1,2)','start_time=' . $sd,]; $arr = $Sql->arr('tongji', $other); $obj = []; $obj['days'] = date('Y-m-d',$sd); foreach ((array)$arr as $val){ switch ($val['type']){ case '1': $obj['signnum'] = $val['result']; break; case '2': $obj['actnum'] = $val['result']; break; } } isset($obj['signnum']) ? NULL : $obj['signnum'] = '0'; isset($obj['actnum']) ? NULL : $obj['actnum'] = '0'; $data[] = $obj; } $data = json_encode($data); $x = ['key'=>'days','label'=>'days']; $y = ['key'=>['signnum','actnum'],'label'=>['注册','日活']]; $char[] = $iframe->chars($charsid,$data,$x,$y,$title); ~~~