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

ChartDateAxisBuilder

Properties

Axis - IChartDateAxis

The base time interval for the axis labels. The default baseUnit is determined automatically from the value range.

Methods

BaseUnit(Kendo.Mvc.UI.ChartAxisBaseUnit)

Sets the date axis base unit.

Parameters

baseUnit - ChartAxisBaseUnit

The date axis base unit

Example


            @(Html.Kendo().Chart()
                    .Name("chart")
                    .CategoryAxis(axis => axis
                        .Date().BaseUnit(ChartAxisBaseUnit.Days)
                    )
            )

Min(System.DateTime)

Sets the start date of the axis.

Parameters

min - System.DateTime

The start date of the axis.

Example


            @(Html.Kendo().Chart(Model)
                       .Name("Chart")
                       .XAxis(a => a.Date().Min(DateTime.Parse("2012/01/01")))
            )

Max(System.DateTime)

Sets the end date of the axis.

Parameters

max - System.DateTime

The end date of the axis.

Example


            @(Html.Kendo().Chart(Model)
                       .Name("Chart")
                       .XAxis(a => a.Date().Max(DateTime.Parse("2012/01/01")))
            )

MajorUnit(System.Double)

Sets the interval between major divisions in base units.

Parameters

majorUnit - System.Double

The interval between major divisions in base units.

Example


            @(Html.Kendo().Chart(Model)
                       .Name("Chart")
                       .XAxis(a => a.Date().BaseUnit(ChartAxisBaseUnit.Months).MajorUnit(4))
            )

MinorUnit(System.Double)

Sets the interval between minor divisions in base units. It defaults to 1/5th of the majorUnit

Parameters

minorUnit - System.Double

The interval between minor divisions in base units.

Example


            @(Html.Kendo().Chart(Model)
                       .Name("Chart")
                       .XAxis(a => a.Date().BaseUnit(ChartAxisBaseUnit.Days).MajorUnit(4).MinorUnit(2))
            )

AxisCrossingValue(System.DateTime)

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

Parameters

axisCrossingValue - System.DateTime

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

Example


            @(Html.Kendo().Chart(Model)
                       .Name("Chart")
                       .XAxis(axis => axis.Date().AxisCrossingValue(DateTime.Parse("2012/01/01")))
            )

AxisCrossingValue(System.DateTime[])

Sets value at which perpendicular axes cross this axis.

Parameters

axisCrossingValues - System.DateTime[]

The values at which perpendicular axes cross this axis.

Example


            @(Html.Kendo().Chart(Model)
                       .Name("Chart")
                       .CategoryAxis(axis => axis.Date().AxisCrossingValue(DateTime.Parse("2012/01/01"), DateTime.Parse("2012/01/10")))
                       .ValueAxis(axis => axis.Numeric().Title("Axis 1"))
                       .ValueAxis(axis => axis.Numeric("secondary").Title("Axis 2"))
            )

AxisCrossingValue(System.Collections.Generic.IEnumerable)

Sets value at which perpendicular axes cross this axis.

Parameters

axisCrossingValues - System.Collections.Generic.IEnumerable<DateTime>

The values at which perpendicular axes cross this axis.

Example


            @(Html.Kendo().Chart(Model)
                       .Name("Chart")
                       .CategoryAxis(axis => axis.Date().AxisCrossingValue(new DateTime[] {
                           DateTime.Parse("2012/01/01"), DateTime.Parse("2012/01/10")
                       }))
                       .ValueAxis(axis => axis.Numeric().Title("Axis 1"))
                       .ValueAxis(axis => axis.Numeric("secondary").Title("Axis 2"))
            )

Labels(System.Action)

Configures the axis labels.

Parameters

configurator - System.Action<ChartDateAxisLabelsBuilder>

The configuration action.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .XAxis(axis => axis
                           .Date()
                           .Labels(labels => labels
                               .Culture(new CultureInfo("es-ES"))
                               .Visible(true)
                           )
                       )
            )

Labels(System.Action)

Configures the axis labels.

Parameters

configurator - System.Action<ChartAxisLabelsBuilder>

The configuration action.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .XAxis(axis => axis
                           .Date()
                           .Labels(labels => labels
                               .Culture(new CultureInfo("es-ES"))
                               .Visible(true)
                           )
                       )
            )

Notes(System.Action)

Defines the items.

Parameters

configurator - System.Action<ChartAxisNotesBuilder>

The items of the notes.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .ValueAxis(a => a.Numeric()
                          .Note(note => note
                               .Data(items =>
                               {
                                   items.Add().Value(1);
                                   items.Add().Value(2);
                               })
                          )
                       )
            )

MajorTicks(System.Action)

Configures the major ticks.

Parameters

configurator - System.Action<ChartAxisTicksBuilder>

The configuration action.

Example


            @(Html.Kendo().Chart(Model)
                       .Name("Chart")
                       .ValueAxis(axis => axis
                           .MajorTicks(ticks => ticks
                               .Visible(false)
                           )
                       )
            )

Crosshair(System.Action)

Configures the major ticks.

Parameters

configurator - System.Action<ChartAxisCrosshairBuilder>

The configuration action.

Example


            @(Html.Kendo().Chart(Model)
                       .Name("Chart")
                       .ValueAxis(axis => axis
                           .Crosshair(crosshair => crosshair
                               .Visible(false)
                           )
                       )
            )

Name(System.String)

Sets the axis name.

Parameters

name - System.String

The axis name.

Example


            @(Html.Kendo().Chart(Model)
                       .Name("Chart")
                       .ValueAxis(axis => axis
                           .Name("axisName")
                       )
            )

MinorTicks(System.Action)

Configures the minor ticks.

Parameters

configurator - System.Action<ChartAxisTicksBuilder>

The configuration action.

Example


            @(Html.Kendo().Chart(Model)
                       .Name("Chart")
                       .ValueAxis(axis => axis
                           .MinorTicks(ticks => ticks
                               .Visible(false)
                           )
                       )
            )

MajorGridLines(System.Action)

Configures the major grid lines.

Parameters

configurator - System.Action<ChartMajorGridLinesBuilder>

The configuration action.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .CategoryAxis(axis => axis
                           .Categories(s => s.DateString)
                           .MajorGridLines(lines => lines.Visible(true))
                       )
            )

MajorGridLines(System.Int32,System.String,Kendo.Mvc.UI.ChartDashType)

Sets color and width of the major grid lines and enables them.

Parameters

width - System.Int32

The major gridlines width

color - System.String

The major gridlines width

dashType - ChartDashType

The major gridlines line dashType.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .CategoryAxis(axis => axis
                           .Categories(s => s.DateString)
                           .MajorGridLines(2, "red", ChartDashType.Dot)
                       )
            )

MinorGridLines(System.Action)

Configures the minor grid lines.

Parameters

configurator - System.Action<ChartMinorGridLinesBuilder>

The configuration action.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .CategoryAxis(axis => axis
                           .Categories(s => s.DateString)
                           .MinorGridLines(lines => lines.Visible(true))
                       )
            )

MinorGridLines(System.Int32,System.String,Kendo.Mvc.UI.ChartDashType)

Sets color and width of the minor grid lines and enables them.

Parameters

width - System.Int32

The minor gridlines width

color - System.String

The minor gridlines width

dashType - ChartDashType

The minor grid lines dash type

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .CategoryAxis(axis => axis
                           .Categories(s => s.DateString)
                           .MinorGridLines(2, "red", ChartDashType.Dot)
                       )
            )

Line(System.Action)

Configures the axis line.

Parameters

configurator - System.Action<ChartLineBuilder>

The configuration action.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .CategoryAxis(axis => axis
                           .Categories(s => s.DateString)
                           .Line(line => line.Color("#f00"))
                       )
            )

Line(System.Int32,System.String,Kendo.Mvc.UI.ChartDashType)

Sets color and width of the lines and enables them.

Parameters

width - System.Int32

The axis line width

color - System.String

The axis line width

dashType - ChartDashType

The axis line dashType.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .CategoryAxis(axis => axis
                           .Categories(s => s.DateString)
                           .Line(2, "#f00", ChartDashType.Dot)
                       )
            )

Labels(System.Boolean)

Sets the visibility of numeric axis chart labels.

Parameters

visible - System.Boolean

The visibility. The default value is false.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .CategoryAxis(axis => axis.Labels(true))
            )

PlotBands(System.Action)

Defines the plot bands items.

Parameters

configurator - System.Action<ChartAxisPlotBandsFactory>

The add action.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .ValueAxis(axis => axis
                           .Numeric()
                           .Min(0).Max(10)
                           .PlotBands(bands => {
                                bands.Add().From(0).To(4).Color("lightgreen");
                                bands.Add().From(4).To(10).Color("lightblue");
                            })
                       )
            )

Title(System.Action)

Configures the chart axis title.

Parameters

configurator - System.Action<ChartAxisTitleBuilder>

The configuration action.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .CategoryAxis(axis => axis
                           .Categories(s => s.DateString)
                           .Title(title => title.Text("Axis"))
                       )
            )

Title(System.String)

Sets the axis title.

Parameters

title - System.String

The axis title.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .CategoryAxis(axis => axis
                           .Categories(s => s.DateString)
                           .Title("Axis")
                       )
            )

Pane(System.String)

Renders the axis in the pane with the specified name.

Parameters

pane - System.String

The pane name.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .Panes(panes => {
                           panes.Add().Title("Value");
                           panes.Add("volumePane").Title("Volume");
                       })
                       .CategoryAxis(axis => axis
                           .Categories(s => s.DateString)
                           .Pane("volumePane")
                       )
            )

Color(System.String)

Sets the color for all axis elements. Can be overriden by individual settings.

Parameters

color - System.String

The axis color.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .CategoryAxis(axis => axis
                           .Categories(s => s.DateString)
                           .Color("#ff0000")
                       )
            )

Reverse(System.Boolean)

Sets the axis reverse option.

Parameters

reverse - System.Boolean

A value indicating if the axis labels should be rendered in reverse.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .CategoryAxis(axis => axis
                           .Categories(s => s.DateString)
                           .Reverse(true)
                       )
            )

Reverse()

Sets the axis reverse option.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .CategoryAxis(axis => axis
                           .Categories(s => s.DateString)
                           .Reverse(true)
                       )
            )

Visible(System.Boolean)

Sets the axis visibility

Parameters

visible - System.Boolean

The axis visibility.

Example


            @(Html.Kendo().Chart()
                      .Name("Chart")
                      .CategoryAxis(axis => axis
                          .Visible(false)
                      )
            )

StartAngle(System.Double)

The angle (degrees) where the 0 value is placed. It defaults to 0.

Parameters

startAngle - System.Double

Angles increase counterclockwise and 0 is to the right. Negative values are acceptable.

NarrowRange(System.Boolean)

A value indicating if the automatic axis range should snap to 0.

Parameters

narrowRange - System.Boolean

The narrowRange value.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .ValueAxis(axis => axis
                           .Numeric()
                           .NarrowRange(false)
                       )
            )

Background(System.String)

Sets the axis background color

Parameters

background - System.String

The axis background.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .ValueAxis(axis => axis
                           .Numeric()
                           .Background("lightblue")
                       )
            )

RangeLabels(System.Action)

Configures the axis range labels.

Parameters

configurator - System.Action<ChartAxisRangeLabelsBuilder>

The configuration action.

Example


            @(Html.Kendo().Chart()
                       .Name("Chart")
                       .CategoryAxis(axis => axis
                           .RangeLabels(labels => labels
                               .Color("Red")
                               .Visible(true)
                           )
                       )
            )

In this article
Not finding the help you need?