x-axis crossing incorrect

2 posts, 0 answers
  1. Mark
    Mark avatar
    18 posts
    Member since:
    Dec 2010

    Posted 01 Jan 2016 Link to this post

    I am just starting to learn the MVC charts, and I am having a problem with the x-axis labels.  I have not found the right setting to correct it.  I have a line chart that may or may not go below zero on the Y-axis.  The date labels are showing under $0, where they should always be at the bottom of the chart.

    Here is the view:

    .Title("Weekly Cash Flow")
    .Legend(legend => legend.Position(ChartLegendPosition.Bottom))
    .Tooltip(tooltip => tooltip.Visible(true))
    .DataSource(ds => ds.Read(read => read.Action("CFForecastData_Read", "Chart")))
    .Series(series => {
    series.Line(a => a.CashBalance).Name("Cash Balance").Color("Blue").Markers(false);
    series.Line(a => a.RequiredBalance).Name("Required Balance").Color("Yellow").Markers(false);
    series.Line(a => a.ZeroLine).Name("Zero").Color("Red").Markers(false);
    series.Line(a => a.Receipts).Name("Receipts").Color("Green").Markers(false);
    series.Line(a => a.Disbursements).Name("Disbursements").Color("Black").Markers(false);
    .CategoryAxis(axis => axis
    .Categories(model => model.ReportDate)
    .Pannable(pannable => pannable
    .Zoomable(zoomable => zoomable
    .Mousewheel(mousewheel => mousewheel.Lock(ChartAxisLock.Y))
    .Selection(selection => selection.Lock(ChartAxisLock.Y))




  2. Iliana Nikolova
    Iliana Nikolova avatar
    2622 posts

    Posted 05 Jan 2016 Link to this post

    Hi Mark,

    In order to achieve this you could use two category axes and specify valueAxis axisCrossingValue. For working example take a look at this online demo.

    Iliana Nikolova
    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
Back to Top