I have a user requirement to plot a chart as shown in the attached image (VerticalLine.JPG).
@(Html.Kendo().Chart<MyProject.WebAPI.MyChart.MyModel()>()
.Name("statistics")
.Title("User Interaction (Days)")
.Legend(legend => legend
.Position(ChartLegendPosition.Top)
)
.DataSource(ds => ds.Read(read => read.Url("/api/GetUserStats").Type(HttpVerbs.Get)))
.Series(series =>
{
series.Column(model => model.UserCount).Name("Total").Gap(.2).Color("#4169e1");
})
.CategoryAxis(axis => axis
.Categories(a => a.UserScore)
.Title("Days")
)
.ValueAxis(axis => axis.Numeric()
.Labels(labels => labels.Format("{0:N0}"))
.MajorUnit(1)
)
.AxisDefaults(a => a
.Labels(l => l.Font("12px Verdana"))
)
.Tooltip(tooltip => tooltip
.Visible(true)
.Shared(true)
.Format("{0:N0}")
)
.Zoomable(zoomable => zoomable
.Mousewheel(mousewheel => mousewheel.Lock(ChartAxisLock.Y))
.Selection(selection => selection.Lock(ChartAxisLock.Y))
)
)
namespace MyProject.WebAPI.MyChart
{
public class MyModel
{
public int UserCount { get; set; }
public int UserScore { get; set; }
public int UserGoal { get; set; }
}
}
ResponseFromWebApi GetUserStats:
[{"UserCount":33,"UserScore":0,"UserGoal":7},{"UserCount":46,"UserScore":1,"UserGoal":7},
{"UserCount":46,"UserScore":2,"UserGoal":7},{"UserCount":32,"UserScore":3,"UserGoal":7},{"UserCount":29,"UserScore":4,"UserGoal":7},{"UserCount":40,"UserScore":5,"UserGoal":7},{"UserCount":45,"UserScore":6,"UserGoal":7},{"UserCount":54,"UserScore":7,"UserGoal":7},{"UserCount":42,"UserScore":8,"UserGoal":7},{"UserCount":31,"UserScore":9,"UserGoal":7},{"UserCount":22,"UserScore":10,"UserGoal":7},{"UserCount":29,"UserScore":11,"UserGoal":7},{"UserCount":25,"UserScore":12,"UserGoal":7},{"UserCount":35,"UserScore":13,"UserGoal":7},{"UserCount":42,"UserScore":14,"UserGoal":7},{"UserCount":28,"UserScore":15,"UserGoal":7},{"UserCount":13,"UserScore":16,"UserGoal":7},{"UserCount":12,"UserScore":17,"UserGoal":7},{"UserCount":10,"UserScore":18,"UserGoal":7},{"UserCount":16,"UserScore":19,"UserGoal":7},{"UserCount":23,"UserScore":20,"UserGoal":7},{"UserCount":24,"UserScore":21,"UserGoal":7},{"UserCount":20,"UserScore":22,"UserGoal":7},{"UserCount":12,"UserScore":23,"UserGoal":7},{"UserCount":17,"UserScore":24,"UserGoal":7},{"UserCount":4,"UserScore":25,"UserGoal":7},{"UserCount":14,"UserScore":26,"UserGoal":7},{"UserCount":5,"UserScore":27,"UserGoal":7},{"UserCount":20,"UserScore":28,"UserGoal":7},{"UserCount":16,"UserScore":29,"UserGoal":7},{"UserCount":16,"UserScore":30,"UserGoal":7},{"UserCount":3,"UserScore":31,"UserGoal":7},{"UserCount":7,"UserScore":32,"UserGoal":7},{"UserCount":10,"UserScore":33,"UserGoal":7},{"UserCount":5,"UserScore":34,"UserGoal":7},{"UserCount":14,"UserScore":35,"UserGoal":7},{"UserCount":9,"UserScore":36,"UserGoal":7},{"UserCount":4,"UserScore":37,"UserGoal":7},{"UserCount":3,"UserScore":39,"UserGoal":7},{"UserCount":7,"UserScore":40,"UserGoal":7}]
The vertical line should be plotted at the value of UserGoal which always will be the same number for all rows, like 7 in above exampe. I tried using PlotBand with hardcoded value (just for testing) but it doesn't plot at value 7. It probably plots at 7th position. If I use Vertical Chart, it plots from position 0 to 7, a diagonal line.
I can get the value of UserGoal via JQuery instead of getting through WebApi but how can I draw the vertical line on existing graph ?