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

x-axis crossing incorrect

1 Answer 61 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 01 Jan 2016, 11:57 PM

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

1 Answer, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 05 Jan 2016, 09:58 AM
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
Tags
Chart
Asked by
Mark
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Share this question
or