@model IEnumerable<WebAppSatisfactionOfCustomers.Models.T_Transaksi>
@{
ViewBag.Title = "Chart";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>GRAFIK PENILAIAN</h2>
<ul>
@foreach (var group in Model.GroupBy(item => item.id_poli))
{
<li>
@foreach (var it in ViewBag.divisidata)
{
if (int.Parse(group.Key) == it.id_poli)
{
<h1>@Html.Encode(@it.nama_poli)</h1>
}
}
@{
var filePathNamegroup = "~/Images/" + group.Key + ".jpg";
var chartImageGroup = new Chart(600, 400);
chartImageGroup.AddTitle("GRAFIK KEPUASAN");
chartImageGroup.AddLegend("Koresponden", "5 ");
chartImageGroup.AddSeries(
name: "" + group.Count(),
axisLabel: "Name",
xValue: new[] { "Puas", "Tidak Puas" },
yValues: new[] { group.Where(kondisi => kondisi.id_kategori.Contains("1")).Count().ToString(), group.Where(kondisi => kondisi.id_kategori.Contains("2")).Count().ToString() });
chartImageGroup.Save(path: filePathNamegroup);
}
<img src="@Url.Content(filePathNamegroup)" alt="Image" />
<ul>
@foreach (var item in group.GroupBy(itempuas => itempuas.id_kategori))
{
if (item.Key == "1")
{
<h4>Grafik Kategori Puas</h4>
var filePathName = "~/Images/" + group.Key + item.Key + ".jpg";
var filename = group.Key + item.Key;
var chartImage = new Chart(600, 400);
chartImage.AddTitle("GRAFIK KATEGORI PUAS (" + item.Count() + " dari " + group.Count() + ")");
chartImage.AddSeries(
name: "Employee",
axisLabel: "Name",
xValue: new[] { "Waktu Pelayanan", "Cara Pelayanan", "Keramahan", "Komunikasi", "Waktu Tunggu" },
yValues: new[] { @item.Where(kondisi => kondisi.id_pertanyaan.Contains("1")).Count().ToString(), @item.Where(kondisi => kondisi.id_pertanyaan.Contains("2")).Count().ToString(), @item.Where(kondisi => kondisi.id_pertanyaan.Contains("3")).Count().ToString(), @item.Where(kondisi => kondisi.id_pertanyaan.Contains("4")).Count().ToString(), @item.Where(kondisi => kondisi.id_pertanyaan.Contains("5")).Count().ToString() });
chartImage.Save(path: filePathName);
<img src="@Url.Content(filePathName)" alt="Image" />
}
else
{
var filePathName = "~/Images/" + group.Key + item.Key + ".jpg";
var chartImage = new Chart(600, 400);
chartImage.AddTitle("GRAFIK KATEGORI TIDAK PUAS (" + item.Count() + " dari " + group.Count() + ")");
chartImage.AddSeries(
name: "Employee",
axisLabel: "Name",
xValue: new[] { "Waktu Pelayanan", "Cara Pelayanan", "Keramahan", "Komunikasi", "Waktu Tunggu" },
yValues: new[] { @item.Where(kondisi => kondisi.id_pertanyaan.Contains("1")).Count().ToString(), @item.Where(kondisi => kondisi.id_pertanyaan.Contains("2")).Count().ToString(), @item.Where(kondisi => kondisi.id_pertanyaan.Contains("3")).Count().ToString(), @item.Where(kondisi => kondisi.id_pertanyaan.Contains("4")).Count().ToString(), @item.Where(kondisi => kondisi.id_pertanyaan.Contains("5")).Count().ToString() });
chartImage.Save(path: filePathName);
<h4>Grafik Kategori Tidak Puas</h4>
<img src="@Url.Content(filePathName)" alt="Image" />
}
}
</ul>
</li>
}
</ul>
===> CONTROLER
public ActionResult Chart()
{
ViewBag.divisidata = db.divisi;
return View(db.transaksi.ToList());
}
{
ViewBag.divisidata = db.divisi;
return View(db.transaksi.ToList());
}
No comments:
Post a Comment