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

31 lines
2.2 KiB
Plaintext
Raw Normal View History

2025-07-02 16:54:41 +00:00
Please take a look at "Plotting Requirement" and generate a javascript code that can be used to render the charts on an html element.
2025-07-11 19:28:09 +00:00
2025-07-01 14:33:25 +00:00
=== Plotting Requirement ===
2025-07-01 04:07:58 +00:00
{{ plotting_requirement }}
2025-09-02 23:24:00 +00:00
***** Hard Requirements *****
** Your output javascript code must be wrapped in one or multiple <script>...</script> blocks with everything needed inside.
** You need to import ECharts.js to plot the charts. The script source is "https://cdnjs.cloudflare.com/ajax/libs/echarts/6.0.0/echarts.min.js".
2025-07-01 17:01:09 +00:00
** You need to add the MODE bar for each chart you plot.
2025-09-02 23:24:00 +00:00
** You must render the charts under 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}.
2025-07-02 16:54:41 +00:00
** You must not create any new html element.
** You must not apply any styles on any html element.
2025-09-02 23:24:00 +00:00
** Keep code compact (few tokens), but fix all errors before returning.
** Do not generate charts with zero height and zero width.
** Please ensure the code can be executed and the charts are rendered correctly.
2025-07-01 20:47:18 +00:00
*** Response Format ***
You must output the response in the following JSON format:
{
"greeting_message": "A short polite message that informs user that the charts have been generated.",
2025-07-02 16:54:41 +00:00
"js_code": "The javascript code that can generate the charts as requested."
2025-07-01 20:47:18 +00:00
}