You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `VisualizerComponent` extends the LLM Chat functionality by providing intelligent data visualization capabilities. This component automatically generates charts and graphs based on database query results, making data insights more accessible and visually appealing.
179
+
180
+
### Features
181
+
182
+
-**Automatic Visualization Selection** - The system intelligently selects the most appropriate visualization type based on the data structure and user prompt
183
+
-**Multiple Chart Types** - Supports bar charts, line charts, and pie charts out of the box
184
+
-**LLM-Powered Configuration** - Uses AI to generate optimal chart configurations including axis selection, orientation, and styling
185
+
-**Seamless Integration** - Works directly with datasets generated by the DbQueryComponent
186
+
187
+
### Available Visualizers
188
+
189
+
The component includes three built-in visualizers:
190
+
191
+
#### Bar Chart Visualizer (`src/components/visualization/visualizers/bar.visualizer.ts:13`)
192
+
193
+
-**Best for**: Comparing values across different categories or showing trends over time
194
+
-**Configuration**: Automatically determines category column (x-axis) and value column (y-axis)
195
+
-**Options**: Supports both vertical and horizontal orientations
196
+
197
+
#### Line Chart Visualizer (`src/components/visualization/visualizers/line.visualizer.ts`)
198
+
199
+
-**Best for**: Displaying trends and changes over time
200
+
-**Configuration**: Optimized for time-series data and continuous variables
201
+
202
+
#### Pie Chart Visualizer (`src/components/visualization/visualizers/pie.visualizer.ts`)
203
+
204
+
-**Best for**: Showing proportions and percentages of a whole
205
+
-**Configuration**: Automatically identifies categorical data and corresponding values
// Generate configuration based on the data and user prompt
265
+
return {
266
+
// your custom chart configuration
267
+
};
268
+
}
269
+
}
270
+
```
271
+
272
+
### Configuration
273
+
274
+
The visualizer component automatically registers all available visualizers and makes them available to the LLM. No additional configuration is required for basic usage. You can register a new visualizer using the `@visualizer` decorator on a class following the IVisualizer interface.
275
+
276
+
### Integration with DbQueryComponent
277
+
278
+
The visualizer component works seamlessly with the `DbQueryComponent`:
279
+
280
+
1. Use database query tools to generate datasets
281
+
2. The visualization tool automatically accesses dataset metadata including:
282
+
- SQL query structure
283
+
- Query description
284
+
- User's original prompt
285
+
3. This context helps generate more accurate and relevant visualizations
286
+
176
287
## Providing Context
177
288
178
289
There are two ways to provide context to the LLM -
0 commit comments