Skip to content

Store canvas as html#22691

Open
linev wants to merge 11 commits into
root-project:masterfrom
linev:canvas_html
Open

Store canvas as html#22691
linev wants to merge 11 commits into
root-project:masterfrom
linev:canvas_html

Conversation

@linev

@linev linev commented Jun 24, 2026

Copy link
Copy Markdown
Member

Now canvas (or several canvases) can be stored in portable HTML file.
Just call c1->SaveAs("canvas.html") or invoke correspondent menu item.
To store several canvases in single HTML file one can use:

   auto c1 = new TCanvas("c1", "c1", 4);
   auto c2 = new TCanvas("c2", "c2", 4);
   auto c3 = new TCanvas("c3", "c3", 4);
   TCanvas::SaveAll({c1, c2, c3}, "canvases.html");

Produced HTML file will include canvas JSON data and JavaScript code to load and display canvas.
Such file can be loaded locally in any web browser or send as attachment in email to colleagues.

Also plain JSROOT now support such feature.

Add several tests to verify that HTML and JSON files are produced and have expected size.

Add release notes

Example of such stored file:

canvas.html

all.html

linev added 10 commits June 24, 2026 12:36
TWebCanvas can create JSON for any canvas.
Now let store such JSON in  HTML file which also includes
minimal JavaScript code to display such object.
Supported also store of several canvases into single HTML file -
using TCanvas::SaveAll() method.
In such case TWebCanvas methods invoked via interpreter
Use flex layout and shadows like in pure JSROOT
Like for all other images users can see which files are actually created and size of created files.
Test storage of single canvas and several canvases using TCanvas::SaveAll() method

webgui component is required to run such tests
Add item in Save menu and add *.html to list
of supported file types in SaveAs dialog
Add correspondent entries to "Save" and "Save as" menu commands.
1. Let store canvas as html file via context menu
1. Improve `TGraph` update
1. When draw TH2/TF2 with "surf same" draw option, only lines are drawn
1. Fix - prevent very long header in context menu
1. Fix - draw 3d contours in "surf3" twice https://root-forum.cern.ch/t/64910
After JSROOT update SURF3 produce more output for contour plot
@ferdymercury

Copy link
Copy Markdown
Collaborator

Impressive! Thanks for this.

@github-actions

Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 16h 5m 12s ⏱️
 3 874 tests  3 874 ✅ 0 💤 0 ❌
77 411 runs  77 411 ✅ 0 💤 0 ❌

Results for commit b6fb713.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants