x-axis crossing incorrect

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

    Posted 01 Jan 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:

    @(Html.Kendo().Chart<tpe2.db.CFForecastData>()
    .Name("chart")
    .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)
    //.AxisCrossingValue(-200000)
    )
    .Pannable(pannable => pannable
    .Lock(ChartAxisLock.Y)
    )
    .Zoomable(zoomable => zoomable
    .Mousewheel(mousewheel => mousewheel.Lock(ChartAxisLock.Y))
    .Selection(selection => selection.Lock(ChartAxisLock.Y))
    )
    )

     

    Thanks!

    Mark

  2. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2595 posts

    Posted 05 Jan 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.

    Regards,
    Iliana Nikolova
    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
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top