Skip to content

Commit 21a7c9b

Browse files
authored
Merge pull request #1140 from iceljc/master
refine chart plot instruction
2 parents ebf3410 + abfc7a8 commit 21a7c9b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-chart-plot_instruction.liquid

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
Please take a look at "Plotting Requirement" and generate a javascript code that can be used to render the charts on an html element.
22

3-
43
=== Plotting Requirement ===
54
{{ plotting_requirement }}
65

7-
8-
***** Important *****
6+
***** Hard Requirements *****
97
** Your output must be a single <script>...</script> block with everything needed inside.
108
** 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".
119
** You need to add the MODE bar for each chart you plot.
1210
** You must render the charts on the div html element with id {{ chart_element_id }}.
11+
** 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:
12+
* Always call the Fullscreen API on the chart container div itself (document.getElementById("{{ chart_element_id }}")), not on the document or on Plotly’s SVG.
13+
* Use el.requestFullscreen() with fallbacks to el.webkitRequestFullscreen || el.msRequestFullscreen.
14+
* Exit fullscreen with document.exitFullscreen() and vendor fallbacks.
15+
* Listen for fullscreenchange, webkitfullscreenchange, and msfullscreenchange to keep the button working across repeated clicks and ESC exits.
16+
* Ensure the chart fully expands and scales to the entire screen when fullscreen is active.
17+
* Provide a simple inline SVG path icon for the button (no external assets).
18+
* Use Plotly.newPlot(container, data, layout, {displayModeBar:true, modeBarButtonsToAdd:[fullscreenBtn]});
19+
* fullscreenBtn must be a fully-formed object {name, title, icon, click}.
1320
** You must not create any new html element.
1421
** You must not apply any styles on any html element.
15-
** You must generate as less token as possible.
22+
** Keep code compact (few tokens), but fix all errors before returning.
23+
** Please fix any code errors before returning the final response.
1624

1725
*** Response Format ***
1826
You must output the response in the following JSON format:

0 commit comments

Comments
 (0)