Getting Started with the Kendo UI for Angular Charts
This guide provides the information you need to start using the Kendo UI for Angular Charts—it includes instructions about the recommended installation approach, the code for running the project, and links to additional resources.
As of version
17.0.0
, Angular makes standalone component enabled by default. If you useNgModules
, refer to these articles:
The standalone components in Angular streamline development by removing the need for NgModules
, reducing complexity, and enhancing component reuse and modularity. This approach simplifies dependency management, making applications more maintainable and scalable.
After the completion of this guide, you will be able to achieve an end result as demonstrated in the following example.
Setting Up Your Angular Project
Before you start with the installation of any Kendo UI for Angular control, ensure that you have a running Angular project. The prerequisites to accomplish the installation of the components are always the same regardless of the Kendo UI for Angular package you want to use, and are fully described in the section on setting up your Angular project.
Installing the Components
The following command demonstrates an efficient, automated method for adding packages using the Angular CLI through the ng-add
command. This approach saves time and effort by executing a series of commands in a single step, which otherwise need to be run individually. Refer to the Manual Setup for more details.
To add the Kendo UI for Angular Charts package:
-
Run the following command.
shng add @progress/kendo-angular-charts
As a result, the
ng-add
command will perform the following actions:- Add the
@progress/kendo-angular-charts
package as a dependency to thepackage.json
file. - Add all required peer dependencies to the
package.json
file. - Register the Kendo UI Default theme in the
angular.json
file. - Trigger
npm install
to install the theme and all peer packages that are added.
- Add the
-
Import the required components, directives and utility arrays:
The utility arrays are available starting from
v16.6.0
. If you use an older version of the package, please follow the approach from the Using Kendo Angular Components with NgModules article.-
To add all components from the Charts package, import the
KENDO_CHARTS
utility array in your standalone component.tsimport { Component } from '@angular/core'; import { KENDO_CHARTS} from '@progress/kendo-angular-charts'; @Component({ standalone: true, selector: 'my-app', imports: [KENDO_CHARTS] })
-
To add individual Charts components, import the corresponding utility arrays in your standalone component. See the list of available utility arrays.
For example if you only need the StockChart component, import
KENDO_STOCKCHART
.tsimport { Component } from '@angular/core'; import { KENDO_STOCKCHART } from '@progress/kendo-angular-charts'; @Component({ standalone: true, selector: 'my-app', imports: [KENDO_STOCKCHART] })
-
Using the Components
-
After successfully installing the Charts package and importing the required components and directives, add the corresponding tags of the components you need in the
app.component.html
. For example, if you need the Chart, add the following code:html<kendo-chart> <kendo-chart-series> <kendo-chart-series-item [data]="[1, 4, 5, 2, 1, 8]"> </kendo-chart-series-item> </kendo-chart-series> </kendo-chart>
-
Build and serve the application by running the following command in the root folder.
shng serve
-
Point your browser to http://localhost:4200 to see the Kendo UI for Angular Chart component on the page.
Activating Your License Key
As of December 2020, using any of the UI components from the Kendo UI for Angular library requires either a commercial license key or an active trial license key. If your application does not contain a Kendo UI license file, activate your license key.
Next Steps
- Chart Overview
- StockChart Overview
- Sparkline Overview
- Sankey Diagram Overview
- Charts API Documentation
Learning Resources
- Angular Charts Homepage
- Charts Overview
- Angular Charts Building Elements
- Angular Chart Types
- API Reference of the Angular Charts
- Get Started with Kendo UI for Angular
- Using Kendo UI for Angular with Angular CLI
- Styling Overview
- Theme Builder
- Customizing the Themes
- Activating Your License Key
- Virtual Classroom (Training Courses for Registered Users)