Angular Reference

Introduction
KeyLines is compatible with many JavaScript frameworks, including Angular. You can write your own Angular component, or you can use the example which is available in angular‑keylines.js when you download KeyLines.
Our component is written in TypeScript, and can be used with modern bundlers such as Webpack or Vite.
Our component is up to date with the latest KeyLines API and regularly tested against the most recent Angular version, so we recommend using the latest version of the component for best performance and compatibility.
To help you get started, we've put together an Angular Tutorial as well as an Angular Integration demo.
Reference
This section explains the kl-components
and kl-component
components found in angular‑keylines.ts
and lists all the optional properties that are available in the wrapper to specify the various elements of the KeyLines chart.
kl-component
kl-component
is an Angular component that contains a KeyLines chart or timebar.
<kl-component
id='string'
klContainerClass='string'
klEvents='function'
klReady='function'
klOptions='object'
klType='string'
>
</kl-component>
Property | Type | Description |
---|---|---|
id | string | The id which will be assigned to the component's canvas element. |
klContainerClass | string | The name of the CSS class to be assigned to the container div of the KeyLines component. |
klEvents | function | Attaches all event handling code provided for the Angular component. Uses the following object format:
See how this works in the Step 7 of Using KeyLines with Angular. See available events in the Chart Events and Time Bar Events APIs. |
klReady | function | A function name to callback when the KeyLines component is ready to use. The argument passed in will be the component set up as specified. |
klOptions | object | Overrides the default options of your component's APIs once the component is created. See the available Chart options and Time Bar options APIs. |
klType | string | The type of KeyLines component: either 'chart' or 'timebar'. Defaults to 'chart'. |
kl-components
kl-components
is a wrapper required around kl-component
and any other child KeyLines components.
<kl-components
klImagesPath='string'
klReady='function'>
<!-- <kl-component> wrapped here -->
</kl-components>
Property | Type | Description |
---|---|---|
klImagesPath | string | The path to image resources. For more information, see KeyLines.paths(). |
klReady | function | A function called when all the child KeyLines components are ready to use. This in an easy way to get access to your component's API, passed as an argument of the function. |