L2 Construct: simple_chart_recommender
chart analysisDescription
The chart analyzer L2 analyzes table data to provide multiple intelligent chart recommendations. It leverages an LLM to determine the most appropriate simple chart types, titles, and data structures based on the input table structure, content, and user-specified analysis goals.
L2 Data
- Provider: pontus
- Module: analysis
- Action: simple_chart_recommender
Example Step
{
"name": "insert-your-step-name",
"type": "l2",
"l2_data": {
"provider": "pontus",
"module": "analysis",
"action": "simple_chart_recommender"
}
}
Input
Example
{
"table": {
"headers": ["Month", "Sales", "Expenses"],
"rows": [["Jan", 1000, 800], ["Feb", 1200, 900], ["Mar", 1500, 1100]]
},
"analysis": [
{
"type": "Trend Analysis",
"instruction": "Analyze how sales and expenses change over time"
},
{
"type": "Comparison",
"instruction": "Compare sales to expenses for each month"
}
],
"num_recommendations": 2
}
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pontus.bpa/pkgs/l2/pontus/analysis/simple-chart-recommender-input",
"$ref": "#/$defs/SimpleChartRecommenderInput",
"$defs": {
"ChartAnalysis": {
"properties": {
"type": {
"type": "string"
},
"instruction": {
"type": "string"
}
},
"additionalProperties": false,
"type": "object",
"required": ["type", "instruction"]
},
"SimpleChartRecommenderInput": {
"properties": {
"table": {
"$ref": "#/$defs/Table"
},
"analysis": {
"items": {
"$ref": "#/$defs/ChartAnalysis"
},
"type": "array"
},
"num_recommendations": {
"type": "integer"
}
},
"additionalProperties": false,
"type": "object",
"required": ["table", "analysis", "num_recommendations"]
},
"Table": {
"properties": {
"headers": {
"items": {
"type": "string"
},
"type": "array"
},
"rows": {
"items": {
"items": true,
"type": "array"
},
"type": "array"
}
},
"additionalProperties": false,
"type": "object",
"required": ["headers", "rows"]
}
}
}
Output
Example
{
"chart_recommendations": [
{
"simple_chart": {
"title": "Monthly Sales and Expenses Trend",
"type": "LINE",
"headers": {
"orientation": "horizontal",
"start_row_number": 1,
"start_col_number": 1,
"length": 3
},
"values": {
"orientation": "vertical",
"start_row_number": 2,
"start_col_number": 2,
"length": 3
}
},
"explanation": "This line chart shows the trend of sales and expenses over time, allowing for easy comparison of their growth rates."
},
{
"simple_chart": {
"title": "Monthly Sales vs Expenses Comparison",
"type": "BAR",
"headers": {
"orientation": "vertical",
"start_row_number": 1,
"start_col_number": 1,
"length": 3
},
"values": {
"orientation": "vertical",
"start_row_number": 1,
"start_col_number": 2,
"length": 2
}
},
"explanation": "This bar chart directly compares sales and expenses for each month, highlighting the difference between them."
}
]
}
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pontus.bpa/pkgs/l2/pontus/analysis/chart-analyzer-output",
"$ref": "#/$defs/ChartAnalyzerOutput",
"$defs": {
"ChartAnalyzerOutput": {
"properties": {
"chart_recommendations": {
"items": {
"$ref": "#/$defs/SimpleChartRecommendation"
},
"type": "array"
}
},
"additionalProperties": false,
"type": "object",
"required": ["chart_recommendations"]
},
"Series": {
"properties": {
"orientation": {
"type": "string"
},
"start_row_number": {
"type": "integer"
},
"start_col_number": {
"type": "integer"
},
"length": {
"type": "integer"
}
},
"additionalProperties": false,
"type": "object",
"required": ["orientation", "start_row_number", "start_col_number"]
},
"SimpleChart": {
"properties": {
"title": {
"type": "string"
},
"type": {
"type": "string"
},
"sheet_name": {
"type": "string"
},
"headers": {
"$ref": "#/$defs/Series"
},
"values": {
"$ref": "#/$defs/Series"
}
},
"additionalProperties": false,
"type": "object",
"required": ["title", "type", "headers", "values"]
},
"SimpleChartRecommendation": {
"properties": {
"simple_chart": {
"$ref": "#/$defs/SimpleChart"
},
"explanation": {
"type": "string"
},
"score": {
"type": "integer"
}
},
"additionalProperties": false,
"type": "object",
"required": ["simple_chart"]
}
}
}