This is a migrated thread and some comments may be shown as answers.

How to draw vertical line on categoryaxis at a point for line chart in Razor

1 Answer 248 Views
Chart
This is a migrated thread and some comments may be shown as answers.
ramu
Top achievements
Rank 1
ramu asked on 23 Mar 2016, 06:14 AM

I am trying to draw vertical line on category axis so that I can differentiate previous  values and future from that point. 

 

Razor view:

@(Html.Kendo().Chart()
.Name("chart")
.Title("Scheduled Info")
.Title(title => title.Font("24px Arial"))
.Transitions(false)
.Legend(legend => legend
.Position(ChartLegendPosition.Bottom)
)
.HtmlAttributes(new {style = "border: 1px solid #1593cc;height: 400px;"})
.Legend(true)
.Legend(legend => legend.Font("medium Arial"))

.Series(series =>
{
series.Line(Model.ScheduledD0)
.Style(ChartLineStyle.Smooth)
.Color("#ee7624")
.Name("D0")
.Markers(x => x.Visible(false));
series.Line(Model.ScheduledA14)
.Style(ChartLineStyle.Smooth)
.Color("#1593cc")
.Name("A14")
.Markers(x => x.Visible(false));
})
.CategoryAxis(axis => axis
.Line(line => line.Visible(true))
.MajorGridLines(lines => lines.Visible(true))
.MajorTicks(lines => lines.Visible(false))
.Categories(Model.ScheduledPlotTime)
.Labels(labels=> labels.Step(4)))
.ValueAxis(axis => axis.Numeric()
.Max(100)
.Labels(labels => labels.Format("{0}%")))
)

Model:

public class graphs

{
 public List<decimal> ScheduledA14 { get; set; }
 public List<decimal> ScheduledD0 { get; set; }
public List<string> ScheduledPlotTime { get; set; }
}

 

 

 

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 25 Mar 2016, 06:42 AM
Hi,

You can use the approach demonstrated in this example to draw the line.

Regards,
Daniel
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
ramu
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or