Skip to content

Implemented generatePlotlyChart() to dynamically render charts based … #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Soumya7681
Copy link

This pull request introduces a new utility function that dynamically generates interactive charts using [Plotly.js](https://plotly.com/javascript/) based on structured input data and configuration.


Key Additions:

  • generatePlotlyChart(config): Accepts chart configuration (e.g., chart type, label/value columns, dimensions, etc.) and returns an embeddable HTML string with a rendered Plotly chart.

  • Supports multiple chart types:

    • pie
    • bar
    • line
    • scatter
    • heatmap
    • histogram
    • box
  • Improved output formatting:

    • Returns full HTML content (not just JSON)
    • Can be previewed directly in browser
  • Failsafe Handling:

    • Throws descriptive errors for missing fields
    • Defaults to reasonable layout if config is partially defined

Example Output:

<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
  <div id="chart" style="width:800px;height:600px;"></div>
  <script>
    Plotly.newPlot("chart", [...], {...});
  </script>
</body>
</html>

Why this matters:

This feature enables developers or AI assistants to visually represent database query results or other tabular data using just a JSON configuration — no frontend code needed.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants