Javascript 如何设置日期范围以查看所选日期图表中的数据
HTML、JS和Controller 公共函数graphRequest$请求 { $statistics=DiraStatistics::where'date\u access',$request->date->get; $question\u asked\u sum=$statistics->sum'question\u asked'; $low_confidence_sum=$statistics->sum'low_confidence'; $no\u answer\u sum=$statistics->sum'no\u answer'; $missing_intent_sum=$statistics->sum'missing_intent'; 返回视图'AltHr.Chatbot.graph',压缩'question\u asked\u sum','low\u confidence\u sum','no\u response\u sum','missing\u intent\u sum'; } {{csrf_field}} 日期 选择 $document.readyfunction{ //绘制图表 海图。海图‘容器’{ 图表:{ plotBackgroundColor:null, plotBorderWidth:null, 影子:错, 键入:“馅饼” }, 标题:{ 文本:“饼图” }, 工具提示:{ pointFormat:“{series.name}:{point.percentage:.1f}%” }, 打印选项:{ 馅饼:{ allowPointSelect:true, 光标:“指针”, 数据标签:{ 已启用:false }, showInLegend:对 } }, 学分:{ 已启用:false }, 出口:{ 已启用:false }, 系列:[{ 名称:'百分比', colorByPoint:对, 数据:[{ 姓名:'提出的问题', y:{!!$问题{U sum!!}, 切碎:是的, 所选:真 }, { 名称:“低置信度”, y:{!!$low\u confidence\u sum!!} }, { 姓名:'没有答案', y:{!!$no\u response\u sum!!} }, { 名称:“缺少意图”, y:{!!$missing\u intent\u sum!!} }] }] }; };Javascript 如何设置日期范围以查看所选日期图表中的数据,javascript,php,mysql,laravel,highcharts,Javascript,Php,Mysql,Laravel,Highcharts,HTML、JS和Controller 公共函数graphRequest$请求 { $statistics=DiraStatistics::where'date\u access',$request->date->get; $question\u asked\u sum=$statistics->sum'question\u asked'; $low_confidence_sum=$statistics->sum'low_confidence'; $no\u answer\u sum=$stat
要获取两个日期之间的数据,可以使用whereBetween函数。 文件如下: 例如:
Model::whereBetween('field', array($date_start, $date_end))
因此,在您的代码中:
DiraStatistics::whereBetween('date_access',array($request->date, $request->date_end))->get();