Merge pull request #1140 from iceljc/master

refine chart plot instruction
This commit is contained in:
iceljc 2025-08-28 17:17:21 -05:00 committed by GitHub
commit 21a7c9ba48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,18 +1,26 @@
Please take a look at "Plotting Requirement" and generate a javascript code that can be used to render the charts on an html element.
=== Plotting Requirement ===
{{ plotting_requirement }}
***** Important *****
***** Hard Requirements *****
** Your output must be a single <script>...</script> block with everything needed inside.
** You need to import Plotly.js to plot the charts. The script source should be "https://cdn.plot.ly/plotly-3.0.1.min.js".
** You need to add the MODE bar for each chart you plot.
** You must render the charts on the div html element with id {{ chart_element_id }}.
** Add a custom mode bar button named "Fullscreen" that toggles the chart container in and out of fullscreen using the Fullscreen API. Requirements for this button:
* Always call the Fullscreen API on the chart container div itself (document.getElementById("{{ chart_element_id }}")), not on the document or on Plotlys SVG.
* Use el.requestFullscreen() with fallbacks to el.webkitRequestFullscreen || el.msRequestFullscreen.
* Exit fullscreen with document.exitFullscreen() and vendor fallbacks.
* Listen for fullscreenchange, webkitfullscreenchange, and msfullscreenchange to keep the button working across repeated clicks and ESC exits.
* Ensure the chart fully expands and scales to the entire screen when fullscreen is active.
* Provide a simple inline SVG path icon for the button (no external assets).
* Use Plotly.newPlot(container, data, layout, {displayModeBar:true, modeBarButtonsToAdd:[fullscreenBtn]});
* fullscreenBtn must be a fully-formed object {name, title, icon, click}.
** You must not create any new html element.
** You must not apply any styles on any html element.
** You must generate as less token as possible.
** Keep code compact (few tokens), but fix all errors before returning.
** Please fix any code errors before returning the final response.
*** Response Format ***
You must output the response in the following JSON format: