New to Kendo UI for Angular? Start a free 30-day trial
CategoryBaseUnit
The baseUnit
type of the category axis.
The possible values are:
BaseUnit
—The base time interval for the axis labels."auto"
—The base unit is automatically determined by the minimum difference between subsequent categories."fit"
—ThecategoryAxis.baseUnitStep
and base unit are adjusted so that the number of categories does not exceedcategoryAxis.maxDateGroups
, and theseries.aggregate
function is used to aggregate data based on the selected base unit.
ts
import { Component } from '@angular/core';
import { CategoryBaseUnit } from '@progress/kendo-angular-charts';
@Component({
selector: 'my-app',
template: `
<kendo-chart>
<kendo-chart-category-axis>
<kendo-chart-category-axis-item [baseUnit]="baseUnit" >
</kendo-chart-category-axis-item>
</kendo-chart-category-axis>
<kendo-chart-series>
<kendo-chart-series-item categoryField="category" [data]="data">
</kendo-chart-series-item>
</kendo-chart-series>
</kendo-chart>
`
})
class AppComponent {
public baseUnit: CategoryBaseUnit = "months";
public data: any[] = [{ category: new Date(2000, 0, 1), value: 1 }, { category: new Date(2001, 0, 1), value: 1}];
}
type
CategoryBaseUnit = "milliseconds" | "seconds" | "minutes" | "hours" | "days" | "weeks" | "months" | "years" | "auto" | "fit";