# Angular Chat Chart Visualization

Display financial or statistical data visualizations directly in Chat messages. Users can view and interact with charts and graphs as part of the conversation flow, making data analysis more accessible and engaging.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/conversational-ui/chat/ai-chat/charts/source.txt)

## Setup

To display Chart components inside the Chat messages interface, follow these steps:

1. Follow the [Getting Started with Charts](https://www.telerik.com/kendo-angular-ui-develop/components/charts/installation/getting-started) guide to install and set up the Charts package in your project.

2. Import the necessary Kendo Chart components in your standalone component:

   ```TS
   import { KENDO_CONVERSATIONALUI, Message } from '@progress/kendo-angular-conversational-ui';
   import { KENDO_CHARTS } from '@progress/kendo-angular-charts';

   @Component({
     selector: 'my-app',
     imports: [KENDO_CONVERSATIONALUI, KENDO_CHARTS],
     template: `...`,
   })
   export class AppComponent {}
   ```

3. Prepare the data for the chart you want to display:

   ```TS
   public chartConfigs = {
       line: {
           title: 'Sales Trends',
           data: [
               { name: 'Jan', value: 45000 },
               { name: 'Feb', value: 52000 },
               // ... more data
           ],
       },
   };
   ```

4. Use the [`kendoChatReceiverMessageTemplate`](https://www.telerik.com/kendo-angular-ui-develop/components/conversational-ui/chat/message-templates#user-specific-message-template) to conditionally render charts in messages:

   ```HTML
   <kendo-chat [messages]="messages" [authorId]="sender.id">
     <ng-template kendoChatReceiverMessageTemplate let-message>
       {{ message.text }}
       @if (message.chartData) {
         <div style="margin-top: 16px;">
           <kendo-chart [style.height.px]="250">
             ...
           </kendo-chart>
         </div>
       }
     </ng-template>
   </kendo-chat>
   ```

## Suggested Links

* [AI and Chatbot Integrations](https://www.telerik.com/kendo-angular-ui-develop/components/conversational-ui/chat/ai-chat/integrations)
* [Data Binding](https://www.telerik.com/kendo-angular-ui-develop/components/conversational-ui/chat/data-binding)
* [Overview](https://www.telerik.com/kendo-angular-ui-develop/components/conversational-ui/chat)
* [API Reference of the Chat](https://www.telerik.com/kendo-angular-ui-develop/components/conversational-ui/api)
