New to Telerik UI for ASP.NET MVC? Start a free 30-day trial

Configures the date category axis for the Chart<T>.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Type Parameters:

TModel

The type of the data item to which the chart is bound to

Syntax:

C#
public class ChartDateCategoryAxisBuilder<TModel> : ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>> where TModel : class

Inheritance: objectChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>ChartDateCategoryAxisBuilder<TModel>

Inherited Members ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.MajorTicks(Action<ChartAxisTicksBuilder>)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.Crosshair(Action<ChartAxisCrosshairBuilder>)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.Name(string)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.MinorTicks(Action<ChartAxisTicksBuilder>)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.MajorGridLines(Action<ChartMajorGridLinesBuilder>)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.MajorGridLines(int, string, ChartDashType)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.MinorGridLines(Action<ChartMinorGridLinesBuilder>)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.MinorGridLines(int, string, ChartDashType)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.Line(Action<ChartLineBuilder>)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.Line(int, string, ChartDashType)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.Labels(Action<ChartAxisLabelsBuilder>)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.Labels(bool)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.PlotBands(Action<ChartAxisPlotBandsFactory<IChartDateCategoryAxis, DateTime>>)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.Title(Action<ChartAxisTitleBuilder>)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.Title(string)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.Pane(string)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.Color(string)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.Reverse(bool)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.Reverse()ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.Visible(bool)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.NarrowRange(bool)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.Background(string)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.RangeLabels(Action<ChartAxisRangeLabelsBuilder>)ChartAxisBuilderBase<IChartDateCategoryAxis, DateTime, ChartDateCategoryAxisBuilder<TModel>>.Axisobject.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

Initializes a new instance of the ChartCategoryAxisBuilder<TModel> class.

C#
public ChartDateCategoryAxisBuilder(Chart<TModel> chart, IChartDateCategoryAxis axis)
Parameters:chartChart<TModel>

The chart.

axisIChartDateCategoryAxis

The date category axis.

Properties

The parent Chart

C#
public Chart<TModel> Container { get; }

Methods

Specifies the discrete baseUnitStep values when either BaseUnit is set to Fit or BaseUnitStep is set to 0 (auto).

C#
public ChartDateCategoryAxisBuilder<TModel> AutoBaseUnitSteps(Action<ChartAxisBaseUnitStepsBuilder> configurator)
Parameters:configuratorAction<ChartAxisBaseUnitStepsBuilder>

The configuration action.

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Date().AutoBaseUnitSteps(steps =&gt; steps.Days(1, 5, 10))
)
)

Sets value at which the first perpendicular axis crosses this axis.

C#
public ChartDateCategoryAxisBuilder<TModel> AxisCrossingValue(double axisCrossingValue)
Parameters:axisCrossingValuedouble

The value at which the first perpendicular axis crosses this axis.

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart(Model)
.Name("Chart")
.CategoryAxis(axis =&gt; axis.Date().AxisCrossingValue(4))
.ValueAxis(axis =&gt; axis.Numeric().Title("Axis 1"))
.ValueAxis(axis =&gt; axis.Numeric("secondary").Title("Axis 2"))
)

Sets value at which perpendicular axes cross this axis.

C#
public ChartDateCategoryAxisBuilder<TModel> AxisCrossingValue(IEnumerable<double> axisCrossingValues)
Parameters:axisCrossingValuesIEnumerable<double>

The values at which perpendicular axes cross this axis.

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart(Model)
.Name("Chart")
.CategoryAxis(axis =&gt; axis.Date().AxisCrossingValue(new double[] { 0, 10 }))
.ValueAxis(axis =&gt; axis.Numeric().Title("Axis 1"))
.ValueAxis(axis =&gt; axis.Numeric("secondary").Title("Axis 2"))
)

Sets value at which perpendicular axes cross this axis.

C#
public ChartDateCategoryAxisBuilder<TModel> AxisCrossingValue(params double[] axisCrossingValues)
Parameters:axisCrossingValuesdouble[]

The values at which perpendicular axes cross this axis.

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart(Model)
.Name("Chart")
.CategoryAxis(axis =&gt; axis.Date().AxisCrossingValue(0, 10))
.ValueAxis(axis =&gt; axis.Numeric().Title("Axis 1"))
.ValueAxis(axis =&gt; axis.Numeric("secondary").Title("Axis 2"))
)

Sets the date category axis base unit.

C#
public ChartDateCategoryAxisBuilder<TModel> BaseUnit(ChartAxisBaseUnit baseUnit)
Parameters:baseUnitChartAxisBaseUnit

The date category axis base unit

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Date().BaseUnit(ChartAxisBaseUnit.Days)
)
)

Sets the step (interval) between categories in base units. Specifiying 0 (auto) will set the step to such value that the total number of categories does not exceed MaxDateGroups.

C#
public ChartDateCategoryAxisBuilder<TModel> BaseUnitStep(int baseUnitStep)
Parameters:baseUnitStepint

the step (interval) between categories in base units. Set 0 for automatic step. The default value is 1.

Returns:

ChartDateCategoryAxisBuilder<TModel>

This option is ignored if baseUnit is set to "fit".

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Date().BaseUnit(ChartAxisBaseUnit.Days).BaseUnitStep(7)
)
)

Defines bound categories.

C#
public ChartDateCategoryAxisBuilder<TModel> Categories(Expression<Func<TModel, DateTime>> expression)
Parameters:expressionExpression<Func<TModel, DateTime>>

The expression used to extract the categories value from the chart model

Returns:

ChartDateCategoryAxisBuilder<TModel>

Defines categories.

C#
public ChartDateCategoryAxisBuilder<TModel> Categories(IEnumerable<DateTime> categories)
Parameters:categoriesIEnumerable<DateTime>

The list of categories

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.CategoryAxis(axis =&gt; axis
.Date().Categories(Model.Categories)
)
)

Defines categories.

C#
public ChartDateCategoryAxisBuilder<TModel> Categories(params DateTime[] categories)
Parameters:categoriesDateTime[]

The list of categories

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Date().Categories(DateTime.Now, DateTime.Now.AddDays(1), DateTime.Now.AddDays(2))
)
)

Positions categories and series points on major ticks. This removes the empty space before and after the series. This option will be ignored if either Bar, Column, OHLC or Candlestick series are plotted on the axis.

C#
public ChartDateCategoryAxisBuilder<TModel> Justify()
Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Date().Justify()
)
)

Positions categories and series points on major ticks. This removes the empty space before and after the series. This option will be ignored if either Bar, Column, OHLC or Candlestick series are plotted on the axis.

C#
public ChartDateCategoryAxisBuilder<TModel> Justify(bool justified)
Parameters:justifiedbool

A boolean value that indicates if the empty space before and after the series should be removed. The default value is false.

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Date().Justify(true)
)
)

Configures the axis labels.

C#
public ChartDateCategoryAxisBuilder<TModel> Labels(Action<ChartDateAxisLabelsBuilder> configurator)
Parameters:configuratorAction<ChartDateAxisLabelsBuilder>

The configuration action.

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.CategoryAxis(axis =&gt; axis
.Date()
.Labels(labels =&gt; labels
.Culture(new CultureInfo("es-ES"))
.Visible(true)
)
)
)

Sets the date category axis maximum (end) date.

C#
public ChartDateCategoryAxisBuilder<TModel> Max(DateTime max)
Parameters:maxDateTime

The date category axis maximum (end) date

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Date().Max(DateTime.Now)
)
)

Specifies the maximum number of groups (categories) that the chart will attempt to produce when either BaseUnit is set to Fit or BaseUnitStep is set to 0 (auto). This option is ignored in all other cases.

C#
public ChartDateCategoryAxisBuilder<TModel> MaxDateGroups(int maxDateGroups)
Parameters:maxDateGroupsint

the maximum number of groups (categories). The default value is 10.

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Date().BaseUnit(ChartAxisBaseUnit.Days).MaxDateGroups(30)
)
)

The maximum number of ticks and labels to display. Applicabable for date category axis.

C#
public ChartDateCategoryAxisBuilder<TModel> MaxDivisions(double value)
Parameters:valuedouble

The value for MaxDivisions

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Date().MaxDivisions(100)
)
)

Sets the date category axis minimum (start) date.

C#
public ChartDateCategoryAxisBuilder<TModel> Min(DateTime min)
Parameters:minDateTime

The date category axis minimum (start) date

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Date().Min(DateTime.Now)
)
)

Defines the items.

C#
public ChartDateCategoryAxisBuilder<TModel> Notes(Action<ChartAxisNotesBuilder> configurator)
Parameters:configuratorAction<ChartAxisNotesBuilder>

The items of the notes.

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart()
.Name("Chart")
.ValueAxis(a =&gt; a.Numeric()
.Note(note =&gt; note
.Data(data =&gt;
{
data.Add().Value(1);
data.Add().Value(2);
})
)
)
)

If set to false, the min and max dates will not be rounded off to the nearest baseUnit. This option is most useful in combination with explicit min and max dates. It will be ignored if either Bar, Column, OHLC or Candlestick series are plotted on the axis.

C#
public ChartDateCategoryAxisBuilder<TModel> RoundToBaseUnit(bool roundToBaseUnit)
Parameters:roundToBaseUnitbool

A boolean value that indicates if the axis range should be rounded to the nearest base unit. The default value is true.

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Date().RoundToBaseUnit(false)
)
)

Configures the selection

C#
public ChartDateCategoryAxisBuilder<TModel> Select(Action<ChartAxisSelectionBuilder> configurator)
Parameters:configuratorAction<ChartAxisSelectionBuilder>

The configuration action.

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart(Model)
.Name("Chart")
.CategoryAxis(axis =&gt; axis.Select(select =&gt;
select.Mousewheel(mw =&gt; mw.Reverse())
))
)

Sets the selection range

C#
public ChartDateCategoryAxisBuilder<TModel> Select(DateTime? from, DateTime? to)
Parameters:fromDateTime?

The selection range start.

toDateTime?

The selection range end. Note: The specified date is not included in the selected range unless the axis is justified. In order to select all categories specify a value larger than the last date.

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart(Model)
.Name("Chart")
.CategoryAxis(axis =&gt; axis.Select(DateTime.Today.AddMonths(-1), DateTime.Today))
)

Sets the week start day.

C#
public ChartDateCategoryAxisBuilder<TModel> WeekStartDay(DayOfWeek weekStartDay)
Parameters:weekStartDayDayOfWeek

The week start day when the base unit is Weeks. The default is Sunday.

Returns:

ChartDateCategoryAxisBuilder<TModel>

Example:
C#
@(Html.Kendo().Chart()
.Name("chart")
.CategoryAxis(axis =&gt; axis
.Date().WeekStartDay(DayOfWeek.Monday)
)
)