> ## Documentation Index
> Fetch the complete documentation index at: https://docs.emergence.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Plotly Chart Endpoint

> Visualise tabular results from `execute_query` as an interactive Plotly chart. Pass the `rows` from `execute_query` directly as `data`. Supports 25+ chart types (bar, line, heatmap, treemap, sankey, waterfall, parcoords, choropleth, etc.). Pick the chart type based on data shape: bar/line for categorical-vs-numeric, heatmap for matrix, treemap/sunburst for hierarchy, choropleth for geographic, sankey/funnel for flow.



## OpenAPI

````yaml /openapi/em-talk2data-v2.yaml post /talk2data/mcp/generate-plotly-chart
openapi: 3.1.0
info:
  title: Talk to Data Service
  version: 3.2.0-dev1
servers: []
security: []
paths:
  /talk2data/mcp/generate-plotly-chart:
    post:
      tags:
        - mcp
      summary: Generate Plotly Chart Endpoint
      description: >-
        Visualise tabular results from `execute_query` as an interactive Plotly
        chart. Pass the `rows` from `execute_query` directly as `data`. Supports
        25+ chart types (bar, line, heatmap, treemap, sankey, waterfall,
        parcoords, choropleth, etc.). Pick the chart type based on data shape:
        bar/line for categorical-vs-numeric, heatmap for matrix,
        treemap/sunburst for hierarchy, choropleth for geographic, sankey/funnel
        for flow.
      operationId: mcp_generate_plotly_chart
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GeneratePlotlyChartRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeneratePlotlyChartResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '502':
          description: Plotly MCP server unreachable or chart generation failed
        '503':
          description: Plotly MCP server URL not configured
      security:
        - HTTPBearer: []
components:
  schemas:
    GeneratePlotlyChartRequest:
      properties:
        data:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - additionalProperties:
                items: {}
                type: array
              type: object
            - type: string
          title: Data
          description: >-
            Tabular data: JSON array of rows, column-oriented dict, or CSV
            string
        chart_type:
          type: string
          maxLength: 100
          minLength: 1
          title: Chart Type
          description: 'Chart type: bar, line, scatter, pie, etc.'
        options:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Options
          description: 'Optional chart options: title, x_label, y_label, color_scheme'
      type: object
      required:
        - data
        - chart_type
      title: GeneratePlotlyChartRequest
      description: Request body for synchronous Plotly chart generation.
    GeneratePlotlyChartResponse:
      properties:
        success:
          type: boolean
          title: Success
        plotly_json:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Plotly Json
      type: object
      required:
        - success
      title: GeneratePlotlyChartResponse
      description: Synchronous Plotly chart generation result.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````