> For the complete documentation index, see [llms.txt](https://docs.wisej.com/ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/ai/components/api/smartadapter/wisej.ai.adapters.smartchartadapter.md).

# SmartChartAdapter

Namespace: **Wisej.AI.Adapters**

Assembly: **Wisej.AI** (3.5.0.0)

* [SmartAdapter](/ai/components/api/smartadapter.md)
  * [SmartChartAdapter](/ai/components/api/smartadapter/wisej.ai.adapters.smartchartadapter.md)

Represents an adapter that enhances a chart control with AI features.

{% tabs %}
{% tab title="C#" %}

```csharp
public class SmartChartAdapter : SmartAdapter
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class SmartChartAdapter
    Inherits SmartAdapter
```

{% endtab %}
{% endtabs %}

The `SmartChartAdapter` class extends the functionality of a chart control by integrating AI capabilities. It allows for dynamic chart generation and interaction based on the provided data source and prompt.

## Constructors

### ![](/files/ptrKjmmRoQB76pvrIqh0) SmartChartAdapter()

Initializes a new instance of the [SmartChartAdapter](/ai/components/api/smartadapter/wisej.ai.adapters.smartchartadapter.md) class.

## Properties

### ![](/files/ptrKjmmRoQB76pvrIqh0) DataSource

[Object](https://docs.microsoft.com/dotnet/api/system.object): Gets or sets the data source for the chart. (Default: `null`)

The data source is used by the AI to generate the chart based on the specified prompt.

### ![](/files/ptrKjmmRoQB76pvrIqh0) DefaultChartType

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the default chart type to be used. (Default: `"Bar"`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) Description

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets the description of the chart generated by the adapter.

The description is generated based on the AI response to the provided prompt and data source.

### ![](/files/ptrKjmmRoQB76pvrIqh0) Prompt

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the prompt used to generate the chart. (Default: `null`)

Changing the prompt will trigger a re-run of the AI process if [AutoRun](/ai/components/api/smartadapter.md#autorun) is enabled and controls are present.

## Methods

### ![](/files/KL0Ik37djZRr8a07Wopd) OnControlCreated(control)

Called when a control is created and initializes the AI process if [AutoRun](/ai/components/api/smartadapter.md#autorun) is enabled.

| Parameter   | Type                                                      | Description                   |
| ----------- | --------------------------------------------------------- | ----------------------------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) | The control that was created. |

### ![](/files/KL0Ik37djZRr8a07Wopd) RunAsyncCore(control)

Executes the core AI process asynchronously to generate a chart.

| Parameter   | Type                                                      | Description                                   |
| ----------- | --------------------------------------------------------- | --------------------------------------------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) | The control for which the chart is generated. |

**Returns:** [Task\<Message>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task representing the asynchronous operation, with a [Message](/ai/components/api/smartsession/wisej.ai.smartsession.message.md) containing the AI response.

The method uses the provided data source and default chart type to interact with the AI session and generate a chart description.

## Inherited By

| Name                                                                                              | Description                                                                     |
| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| [SmartChartJS3Adapter](/ai/components/api/smartadapter/wisej.ai.adapters.smartchartjs3adapter.md) | Represents an adapter that enhances a ChartJS control with several AI features. |

## Implements

| Name                                                                              | Description                                |
| --------------------------------------------------------------------------------- | ------------------------------------------ |
| [IToolProvider](/ai/components/api/smarttool/wisej.ai.smarttool.itoolprovider.md) | Represents a provider that supplies tools. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wisej.com/ai/components/api/smartadapter/wisej.ai.adapters.smartchartadapter.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
