JavaScript ROOT Bertrand Bellenot (CERN) Sergey Linev (GSI)

Slides:



Advertisements
Similar presentations
Chapter 3 – Web Design Tables & Page Layout
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Java Script Session1 INTRODUCTION.
1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
CIS101 Introduction to Computing Week 08. Agenda Your questions JavaScript text Resume project HTML Project Six This week online Next class.
Intermediate Level Course. Text Format The text styles, bold, italics, underlining, superscript and subscript, can be easily added to selected text. Text.
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
DT211/3 Internet Application Development JSP: Processing User input.
Create slices and hotspots Create links in Web pages Create rollovers from slices Create basic animation Add tweening symbol instances to create animation.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
World Wide Web1 Applications World Wide Web. 2 Introduction What is hypertext model? Use of hypertext in World Wide Web (WWW) – HTML. WWW client-server.
Macromedia Dreamweaver 4 Advanced Level Course. Add Rollovers Rollovers or mouseovers are possibly the most popular effects used in designing Web pages.
ITWS-2210 / CSCI Logistics Format – Class w/ mini projects (graded on class participation) – Labs (individual projects, graded on completion in.
1 The World Wide Web. 2  Web Fundamentals  Pages are defined by the Hypertext Markup Language (HTML) and contain text, graphics, audio, video and software.
Development of mobile applications using PhoneGap and HTML 5
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
Presented by…. Group 2 1. Programming language 2Introduction.
Bertrand Bellenot root.cern.ch ROOT I/O in JavaScript Reading ROOT files from any web browser ROOT Users Workshop
Reading ROOT files in any browser ROOT I/O IN JAVASCRIPT Bertrand Bellenot CERN, PH-SFT.
Website Designing Using Ms FrontPage FrontPage 2003 Create a Web site with FrontPage.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 16: Java Applets & AWT Fundamentals of Web Programming.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
Chapter 33 CGI Technology for Dynamic Web Documents There are two alternative forms of retrieving web documents. Instead of retrieving static HTML documents,
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
Tutorial 1 Getting Started with Adobe Dreamweaver CS3
© 2012 LogiGear Corporation. All Rights Reserved Robot framework.
5 Chapter Five Web Servers. 5 Chapter Objectives Learn about the Microsoft Personal Web Server Software Learn how to improve Web site performance Learn.
IE 411/511: Visual Programming for Industrial Applications
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
E-Commerce: Introduction to Web Development 1 Dr. Lawrence West, Management Dept., University of Central Florida Topics What is a Web.
THttpServer class Sergey Linev (GSI). Some history Development was inspired by JSRootIO why not achieve similar functionality with online ROOT application?
© 2010 Delmar, Cengage Learning Chapter 8 Collecting Data with Forms.
Experiences, limitations and suggested improvements The ALICE DQM Software and ROOT ROOT Users Workshop Barthelemy von Haller & Adriana Telesca for the.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
76 © 1998, 1999, 2000 David T. Gray, Howard Duncan, Jane Kernan Frames When displaying information in a browser, it is sometimes useful to divide the display.
JavaScript - A Web Script Language Fred Durao
THttpServer for ROOT Bertrand Bellenot, CERN Sergey Linev, GSI Darmstadt
Microsoft FrontPage 2003 Illustrated Complete Creating a Form.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
CHEP 2013, Amsterdam Reading ROOT files in a browser ROOT I/O IN JAVASCRIPT B. Bellenot, CERN, PH-SFT B. Linev, GSI, CS-EE.
Chapter 29 World Wide Web & Browsing World Wide Web (WWW) is a distributed hypermedia (hypertext & graphics) on-line repository of information that users.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
SWGData and Software Access - 1 UCB, Nov 15/16, 2006 THEMIS SCIENCE WORKING TEAM MEETING Data and Software Access Ken Bromund GST Inc., at NASA/GSFC.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
Website design and structure. A Website is a collection of webpages that are linked together. Webpages contain text, graphics, sound and video clips.
ROOT I/O in JavaScript Browsing ROOT Files on the Web For more information see: For any questions please use following address:
Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy.
HTML Forms.
Creating Animations, Working with Graphics, and Accessing Data Lesson 9.
Project 5: Using Pop-Up Windows Essentials for Design JavaScript Level One Michael Brooks.
LCG AA Meeting 31 October 2007 The new dynamically and extensively customizable ROOT browser Bertrand Bellenot.
S.Linev: Go4 - J.Adamczewski, H.G.Essel, S.Linev ROOT 2005 New development in Go4.
Reading ROOT files in (almost) any browser.  Use XMLHttpRequest JavaScript class to perform the HTTP HEAD and GET requests  This class is highly browser.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
Online Data Monitoring Framework Based on Histogram Packaging in Network Distributed Data Acquisition Systems Tomoyuki Konno 1, Anatael Cabrera 2, Masaki.
HTML III (Forms) Robin Burke ECT 270. Outline Where we are in this class Web applications HTML Forms Break Forms lab.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
Ashima Wadhwa Java Script And Forms. Introduction Forms: –One of the most common Web page elements used with JavaScript –Typical forms you may encounter.
JavaScript ROOT
3D graphics in JavaScript ROOT
MapServer In its most basic form, MapServer is a CGI program that sits inactive on your Web server. When a request is sent to MapServer, it uses.
Testing REST IPA using POSTMAN
Chapter 27 WWW and HTTP.
ASP.NET Imran Rashid CTO at ManiWeber Technologies.
Presentation transcript:

JavaScript ROOT Bertrand Bellenot (CERN) Sergey Linev (GSI)

JSRootIO project Original project from Bertrand Bellenot o was presented at the ROOT workshop 2013 ROOT I/O in JavaScript o reading ROOT objects using streamer infos many exceptions due to custom streamers o source for the project name - JSRootIO Graphic with d3.js, three.js and jQuery.js Navigating the ROOT files content and displaying objects in modern web browsers JavaScript ROOT, ROOT Workshop2

JSRootIO screenshots JavaScript ROOT, ROOT Workshop3

JSRootIO and http server Could one use JSRootIO with online ROOT application? In general yes, but many hidden problems and caveats: o difficulty with fixed HTML design o lack of objects update o flexible API was missing There was an intermediate solution with many workarounds until a decision was taken to redesign JSRootIO completely JavaScript ROOT, ROOT Workshop4

JavaScript ROOT Preserve old functionality, including look-and-feel Redesign was focused on: o modularity o clear API o more interactive features o more supported classes o support of user classes Project was renamed to JSROOT o binary ROOT files reading is an optional part of the project JavaScript ROOT, ROOT Workshop5

How to use JSROOT? As before, for interactive browsing of ROOT files o open JSROOT web page o load file(s) from web o show content of the files o display objects from the files JavaScript ROOT, ROOT Workshop6

User interface JavaScript ROOT, ROOT Workshop7 layout selection file content file loading

Different layouts JavaScript ROOT, ROOT Workshop8 grid collapsible tabssimple

Context menu with draw options JavaScript ROOT, ROOT Workshop9

Context menu for drawn object JavaScript ROOT, ROOT Workshop10

Informative tooltips JavaScript ROOT, ROOT Workshop11

Intuitive zooming JavaScript ROOT, ROOT Workshop12

How to share results? Before o create and send PNG image (static) o or create and send ROOT file with canvas (interactive) one requires ROOT installed everywhere With JSROOT o copy your ROOT file on web server and send link to the file o open main page o enter file name (like o find and draw histogram or canvas Same actions repeat many times again  o interactive not always mean better o are there alternatives? Solution - use JSROOT UI with URL parameters! JavaScript ROOT, ROOT Workshop13

URL parameters in JSROOT file(s) – name of file(s) to open json – name of json file to open item(s)– item name(s) to display opt(s) – drawing option for the item(s) layout – layout for drawings like grid or tabs nobrowser – do not display objects hierarchy mathjax – enable usage of MathJax.js interactive – enable/disable interactive features load – name of extra JavaScript to load optimize– drawing optimization (0: off,1: large histos, 2: always) JavaScript ROOT, ROOT Workshop14

URL: open file file =../files/graph.root JavaScript ROOT, ROOT Workshop15

URL: display canvas from file file =../files/graph.root& item =exclusion;1& nobrowser JavaScript ROOT, ROOT Workshop16

URL: display several items file =../files/hsimple.root& layout =grid2x2& items =[hpx;1,hpxpy;1,hprof;1,StreamerInfo]& opts =[hist,colz,e1,any] JavaScript ROOT, ROOT Workshop17

URL: display histograms from different files layout =grid1x3& path =../files/& files =[temp44.root,temp35.root,te mp28.root]& items =[temp44.root/Histograms/TDC_C100/Ch3/TDC_C100_Ch3_RisingRef;1,tem p35.root/_same_,temp28.root/_same_]& opts =[autozoom,autozoom,autozoom] JavaScript ROOT, ROOT Workshop18

I/O improvements Make logic closer to original ROOT I/O o introduce JSROOT.TBuffer class o always use checksum to verify content Handle all custom streamers in central place o all kind of ROOT collections o TCanvas, TObjString, TStreamer... classes o make it easier to support user classes with custom streamers support ROOT4, ROOT5 and ROOT6 binary files support servers without byte range selection o let read files from local file system I/O fully independent from graphics o vice versa is also true JavaScript ROOT, ROOT Workshop19

I/O example Reading an object from a ROOT file in JavaScript: var filename = “ new JSROOT.TFile(filename, function(file) { if (file) file.ReadObject("hpxpy;1", function(obj) { console.log(“object name “ + obj.fName); } JavaScript ROOT, ROOT Workshop20

I/O from different web servers JSROOT can access files from any web server o server should enable CORS headers CORS – Cross-Origin Resource Sharing o in simple case for Apache: Header set Access-Control-Allow-Origin "*" Copy JSROOT sources to server with files o source can be found in ROOT distribution o or copied from o no special settings of web server required Take only index.htm from JSROOT Use JSROOT and read files from local file system o like file:///home/user/jsroot/index.htm?file=test.rootfile:///home/user/jsroot/index.htm?file=test.root o very useful for debugging JavaScript ROOT, ROOT Workshop21

Graphics improvements Full code reorganization Introduce painter classes o somehow similar to original ROOT Make several SVG layers o axis, main drawing, labels o easier to overlap many objects later Comfort zooming and stat box update Context menu for additional functionality Significant performance increase Use of MathJax.js JavaScript ROOT, ROOT Workshop22

Supported ROOT classes histograms: o TH1, TH2, TH3, TProfile graphs: o TGraph, TCutG, TGraphErrors, TGraphBentErrors superposition: o THStack, TMultiGraph functions: o TF1 text: o TLatex, TMathText, TPaveText, TPaveStats, TPaveLabel containers: o TCanvas, TPad JavaScript ROOT, ROOT Workshop23

Modularity Code divided on several modules o core, 2d, 3d, io, gui Modules loaded when required o in simple case only three JSROOT scripts are loaded instead of 10 before o could be specified when loading central JSROOT script One could use require.js (optional) Minified version of scripts are provided JavaScript ROOT, ROOT Workshop24

Use in other HTML pages Simplest solution - tag Not the first choice when many objects should be shown on the same page JavaScript ROOT, ROOT Workshop25

Use in other HTML pages Load required functionality: <script type="text/javascript" src=" Provide place for drawing object: Retrieve object and call: JSROOT.draw(“drawing”, obj, “colz”); JavaScript ROOT, ROOT Workshop26

Display object from ROOT file var filename = “ new JSROOT.TFile(filename, function(file) { file.ReadObject("hpxpy;1", function(obj) { JSROOT.draw("drawing", obj, "colz"); }); See JavaScript ROOT, ROOT Workshop27

Display object from JSON file TBufferJSON can create JSON representation o no need for ROOT I/O in JavaScript o more details in the THttpServer presentation on Friday JSROOT.NewHttpRequest("hpx.json", "object", function(obj) { JSROOT.draw("drawing", obj, "hist"); }).send(); See JavaScript ROOT, ROOT Workshop28

Update drawing from JSON var cnt = 0; setInterval(updateGUI, 2000);... function updateGUI() { var addr = "root" + (cnt++ % 20) + ".json"; JSROOT.NewHttpRequest(addr, "object", function(histo) { JSROOT.redraw("drawing", obj, "hist"); }).send(); } See JavaScript ROOT, ROOT Workshop29

Support of user classes One needs to implement and register a drawing function Load the script together with JSROOT If necessary, provide a custom streamer for it Example with TEllipse class o JavaScript code (~70 lines) o Canvas from ROOT reference file =../files/ellipse.root & item =c1;1& load =demo/ellipse.js file =../files/ellipse.root & item =c1;1& load =demo/ellipse.js More examples in go4 framework o see Joern talk on Friday JavaScript ROOT, ROOT Workshop30

TEllipse example JavaScript ROOT, ROOT Workshop31 JSROOT canvas ROOT canvas

ellipse.js drawEllipse = function(divid, obj, opt) { var painter = new JSROOT.TObjectPainter(obj); painter.ellipse = obj; painter.SetDivId(divid); painter['Redraw'] = ellipsePainting; painter.Redraw(); // actual drawing return painter.DrawingReady(); } // register draw function to JSROOT JSROOT.addDrawFunc({ name: "TEllipse", func:drawEllipse }); JavaScript ROOT, ROOT Workshop32

ellipse.js ellipsePainting = function() { var lineatt = JSROOT.Painter.createAttLine(this.ellipse); var fillatt = this.createAttFill(this.ellipse); // (re)create svg:g container for ellipse drawing this.RecreateDrawG(true); var x = this.PadToSvg("x", this.ellipse.fX1); var y = this.PadToSvg("y", this.ellipse.fY1); var rx = this.PadToSvg("x", this.ellipse.fX1 + this.ellipse.fR1) - x; var ry = y - this.PadToSvg("y", this.ellipse.fY1 + this.ellipse.fR2); // only simple case shown, using svg:ellipse this.draw_g.append("svg:ellipse").attr("cx", x).attr("cy", y).attr("rx", rx).attr("ry", ry).call(lineatt.func).call(fillatt.func).append("svg:title").text('svg ellipse'); // more complex drawing with svg:path... } JavaScript ROOT, ROOT Workshop33

Useful links Developers repository o Latest stable version in ROOT o $ROOTSYS/etc/http Latest versions with documentation and examples: o o JavaScript ROOT, ROOT Workshop34

Conclusion JavaScript ROOT provides: Display for popular ROOT classes in web browsers Objects I/O from binary and JSON ROOT files Flexible API for usage in other projects JavaScript ROOT, ROOT Workshop35