L2 Hub
Pontus
analysis
Categorical Chart Recommender

L2 Construct: categorical_chart_recommender

chart analysis

Description

The chart analyzer L2 analyzes table data to provide multiple intelligent chart categorical 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

  1. Provider: pontus
  2. Module: analysis
  3. Action: categorical_chart_recommender

Example Step

{
  "name": "insert-your-step-name",
  "type": "l2",
  "l2_data": {
    "provider": "pontus",
    "module": "analysis",
    "action": "categorical_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/cat-chart-rec-input",
  "$ref": "#/$defs/CatChartRecInput",
  "$defs": {
    "CatChartRecInput": {
      "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"]
    },
    "ChartAnalysis": {
      "properties": {
        "type": {
          "type": "string"
        },
        "instruction": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["type", "instruction"]
    },
    "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 Comparison",
        "type": "COLUMN",
        "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
        }
      }
    },
    {
      "simple_chart": {
        "title": "Monthly Sales and Expenses Comparison",
        "type": "COLUMN",
        "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
        }
      }
    }
  ]
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/pontus/analysis/cat-chart-rec-output",
  "$ref": "#/$defs/CatChartRecOutput",
  "$defs": {
    "CatChartRecOutput": {
      "properties": {
        "chart_recommendations": {
          "items": {
            "$ref": "#/$defs/CatChartRecommendation"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["chart_recommendations"]
    },
    "CatChartRecommendation": {
      "properties": {
        "simple_chart": {
          "$ref": "#/$defs/SimpleChart"
        },
        "score": {
          "type": "integer"
        },
        "reasoning": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["simple_chart"]
    },
    "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"]
    }
  }
}