plot_pie_chart
Generate a pie chart visualization from Teradata database tables by specifying labels and a data column to plot proportional values.
Instructions
Function to generate a pie chart plot for labels and columns. Columns mentioned in labels are used as labels and column is used to plot.
PARAMETERS: table_name: Required Argument. Specifies the name of the table to generate the donut plot. Types: str
labels:
Required Argument.
Specifies the labels to be used for the line plot.
Types: str
column:
Required Argument.
Specifies the column to be used for generating the line plot.
Types: str
RETURNS: dict
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table_name | Yes | ||
| labels | Yes | ||
| column | Yes |
Implementation Reference
- Handler function implementing the plot_pie_chart tool. It queries the specified Teradata table for labels and column data, validates inputs, and returns formatted JSON data suitable for rendering a pie chart using Chart.js via the shared get_plot_json_data helper.def handle_plot_pie_chart(conn: TeradataConnection, table_name: str, labels: str, column: str): """ Function to generate a pie chart plot for labels and columns. Columns mentioned in labels are used as labels and column is used to plot. PARAMETERS: table_name: Required Argument. Specifies the name of the table to generate the donut plot. Types: str labels: Required Argument. Specifies the labels to be used for the line plot. Types: str column: Required Argument. Specifies the column to be used for generating the line plot. Types: str RETURNS: dict """ if not isinstance(labels, str): raise ValueError("labels must be a string representing the column name for x-axis.") return get_plot_json_data(conn, table_name, labels, column, 'pie')