I want to let the user select the machine name, start and end dates and have show charts between those dates to the machine name. Here is my view code with chart script ;
But when I selected dates and machine name I can only get JSON results, how can I implement them to the chart and get a view of them? Here is my Jsonresult and and what I got after the date selection;
public ActionResult Index2(String makineadi, DateTime? startdate, DateTime? enddate)
{
return View();
}
public JsonResult Graphde(String makineadi, DateTime? startdate, DateTime? enddate)
{
var data = entities.Database.SqlQuery<sıcaklık>("SELECT Sıcaklık AS sıcak, Tarih = format(Tarih, 'yyyy-mm-dd HH:mm:ss') From Recete Where Machine_IP = '192.168.0.8' and Tarih between DATEPART(m, DATEADD(m, -1, getdate()))and GETDATE()").ToList();
return Json(data, JsonRequestBehavior.AllowGet);
}
With this return I can turn which dates I want but I can not use them as a chart view here is what I took after <input id="submit" type="submit" value="Arama" /> this button.
Here what I got after entering date range and machine name, How can I filter my chart and how can I use them after selection as chart.
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
1 Points
2 Posts
Filtering chart datas
Feb 16, 2021 11:14 AM|alpaytoprak|LINK
I want to let the user select the machine name, start and end dates and have show charts between those dates to the machine name. Here is my view code with chart script ;
<div>I selected machine name, start and end date from this Html helper form
But when I selected dates and machine name I can only get JSON results, how can I implement them to the chart and get a view of them? Here is my Jsonresult and and what I got after the date selection;
With this return I can turn which dates I want but I can not use them as a chart view here is what I took after <input id="submit" type="submit" value="Arama" /> this button.
Here what I got after entering date range and machine name, How can I filter my chart and how can I use them after selection as chart.
</div> <div></div> <div></div>Participant
970 Points
315 Posts
Re: Filtering chart datas
Feb 17, 2021 08:23 AM|Jerry Cai|LINK
Hi,alpaytoprak
Do you mean when you click the button, but it shows some json rather than update the chart?
You can use ajax call instead to solve it, this is a demo filtered with only enddate:
Result:
Best Regards,
Jerry Cai
Member
1 Points
2 Posts
Re: Filtering chart datas
Feb 17, 2021 11:45 AM|alpaytoprak|LINK
Dear Jerry Cai,
I did it yesterday, but it would be very helpful for other colleagues and I can also use this solution method. Thanks a lot for your kind response.
Best Regards,
Alpay TOPRAK