Hello,
I'm trying to get my chart to display correctly. However, it seems the categories are not correct. Here is my code:
@(Html.Kendo().Chart(Model.CDashBoardLineCounts)
.Name("applicationStepsByDay")
.Legend(legend => legend.Visible(true))
.SeriesDefaults(seriesDefaults =>
seriesDefaults.Line().Style(ChartLineStyle.Smooth)
)
.CategoryAxis(axis => axis
.Categories(Model.Categories)
.MajorGridLines(lines => lines.Visible(false))
)
.Series(series =>
{
foreach (var s in Model.CDashBoardLineCounts)
{
series.Line(model => model.countofitems)
.Name(s.dashcolor)
.CategoryField("dateofCItem");
}
})
.ValueAxis(axis => axis.Numeric()
.Labels(labels => labels.Format("{0}"))
.Line(lines => lines.Visible(false))
)
.Tooltip(tooltip => tooltip
.Visible(true)
.Shared(true)
.Format("{0}")
)
)
public IActionResult Index()
{
CombinedDashBoard x = new CombinedDashBoard();
x.CDashBoardLineCounts = GetAllLineChartDetails();
x.Categories = new string[] { "Green", "Red", "Yellow" };
return View(x);
}
public class CombinedDashBoard
{
public List<
CDashBoardModifiedPieCounts
> CDashBoardPieCounts { get; set; }
public List<
CDashBoardModifiedLineCounts
> CDashBoardLineCounts { get; set; }
public string[] Categories { get; set; }
}
public class CDashBoardModifiedLineCounts
{
public string dashcolor { get; set; }
public string CItemName { get; set; }
public DateTime dateofCItem { get; set; }
public int countofitems { get; set; }
}
I would like to get a line in the chart for Red (that shows count of items that have the color red mapped to the dates), another line that shows all green items mapped to date per count and one for yellow.
Instead I'm getting the chart image attached
Thank you for your time