Sparkline Chart
VIEW
<script src="~/scripts/jquery.sparkline.min.js"></script>
<div style="border:2px solid #cccccc;padding:10px;width:50%; box-shadow: 10px 10px 5px #888888;text-align:center;float:left;">
<h4 style="color:#58B609;">Expirations by Month next 12 months</h4><hr />
<div class="sparkline" data-type="bar" data-width="97%" data-height="250px" data-bar-Width="12" data-bar-Spacing="10" data-bar-Color="#58B609" style="float:left;margin-left:30px;">
@ViewBag.Expire
</div>
$(".sparkline").each(function () {
var $this = $(this);
$this.sparkline('html', $this.data());
});
CONTROLLER
public ActionResult Index(int? id, int? reportType)
{
ViewBag.Expire = getExpiringMonths();
..............................
public string getExpiringMonths()
{
List<int> listofRecords = new List<int>();
string mylist = string.Empty;
List<AgreementExpiration> exp = new List<AgreementExpiration>();
exp = prog.getExpiringChart();
foreach(var a in exp)
{
listofRecords.Add(a.ExpireCount);
mylist = mylist + a.ExpireCount + ",";
}
return mylist;
}
Comments