SlideShare a Scribd company logo
Advanced
     Dojo GFX
 Eugene Lazutkin, DojoToolkit.org
SVG Open 2009, Mountain View, CA




                1
Dojo Toolkit: short intro
•   Consists of four parts:

    •   Dojo Base – the most important part. It is included as soon as you
        include <script src=”dojo.js”></script>.

    •   Dojo Core – generic core components (e.g., DnD) and a foundation
        for everything else.

    •   Dijit – core widgets (form elements, layout components) to
        assemble UI.

                                       2
Dojo Toolkit: short intro
•   DojoX – eXtended Dojo, a repository for less frequently needed
    functionality.

    •   Organized by packages.

    •   Every package includes README listing maintainers, and external
        dependencies.

    •   Can include production and experimental code (see README for
        each package).

                                      3
Dojo Toolkit: short intro

•   Both DojoX GFX and DojoX Charting are housed in DojoX.

•   Both are battle-tested, and were used in serious projects.

    •   SVG and VML renderers were declared of production quality almost
        2 years ago.

    •   Canvas render is actively used in mobile applications.


                                        4
Dojo Toolkit: code

•   Dojo defines just three top-level objects: dojo, dijit, and dojox.
    Everything else is in them.

    •   You don’t need to follow this example for simple projects. I
        frequently define short aliases, for example:
        var d = dojo, g = dojox.gfx;

•   Including modules are easy:
    dojo.require(“dojox.gfx”);

                                       5
Dojo Toolkit: code
•   Module names follow a simple convention:

    •   Examples: dojox.gfx is in dojox/gfx.js, dijit.layout.ContentPane is in
        dijit/layout/ContentPane.js, and so on.

    •   Exception: Dojo Base attaches functions directly to “dojo”, but actual
        code is in dojo/_base/.

        •   Examples: dojo.style is in dojo/_base/html.js, dojo.declare is in dojo/
            _base/declare.js.

                                           6
Dojo Toolkit: docs & help

•   Presently docs are hosted at Dojo Campus:

    •   http://docs.dojocampus.org/

•   Usually names are directly reflected in URL:

    •   Docs for dojox.gfx are at http://docs.dojocampus.org/dojox/gfx

•   See the pattern?


                                      7
Dojo Toolkit: docs & help
•   More “interactive” help:

    •   Mailing lists are very helpful.

        •   Syndicated by Gmane, Nabble, Google Groups.

    •   http://stackoverflow.com/ is frequented by users and contributors.

•   More “immediate” help:

    •   #dojo channel @ freenode
                                          8
Dojo Toolkit: docs & help
•   Do not overlook “reading code”!

    •   In most cases Dojo code is very readable and thoroughly
        commented.

    •   It is a good way to learn how things work, and what API is presented.

    •   You can spot some useful tricks from the code.

•   “Improving code” starts with “reading code”. If you spot a problem,
    open a ticket!
                                       9
Dojo Toolkit: docs & help


•   Dojo’s Trac is at http://bugs.dojotoolkit.org/

    •   Register your name at dojotoolkit.org.

•   Use Trac if you found a bug, or have a good idea for an enhancement.




                                      10
Dojo Toolkit: docs & help
•   Trac hints:

    •   Search Trac to search for a problem before opening a ticket.

    •   Attach files rather than pasting them inline.

    •   If you want to post a snippet, use code formatting {{{code}}}.

    •   Try to distill a problem into a minimal test program.

    •   Attach patches. Tickets with patches are fast-tracked.
                                       11
Dojo GFX
 The crash course




        12
Dojo GFX: major players
•   The package: dojox.gfx

    •   The proper renderer will be automatically selected.

    •   You can change the detection order.

•   dojox.gfx.Surface

    •   A rectangular container for shapes.

    •   Usually it is anchored at <div>.
                                           13
Dojo GFX: shapes & groups
•   Shapes: Rect (with rounded corners), Circle, Ellipse, Line, Polyline,
    Path, Image, Text, TextPath (experimental).

•   dojox.gfx.Group is a special shape, which is used to group other
    shapes.

    •   Its children can be enumerated.

    •   It can be transformed as whole.

    •   It can contain other groups.
                                       14
Dojo GFX: stroke & fill & font
•   Stroke defines how to outline a shape.

    •   You can specify: color, thickness, style (e.g., solid or dash), caps, and
        joints.

•   Fill defines how shape’s interior is going to be filled.

    •   Supported styles: solid color, tiled patterns, linear and radial gradient.

•   Font is used for Text and TextPath shapes.

                                          15
Dojo GFX: color

•   dojo.Color is used to specify all colors.

    •   Any valid CSS3 colors are supported.

    •   CSS named colors are supported with dojo.colors module.

    •   Opacity is supported as well.

        •   Warning:VML doesn’t support opacity in fills.


                                        16
Dojo GFX: transformations
•   dojox.gfx.Matrix2D is used to transform shapes.

    •   Linear 2D transformations are supported: scaling, translation,
        rotation, skewing, and so on.

    •   Practically all matrix operations are provided: multiply matrices,
        invert, transform points, even eigenvalue decomposition.

    •   For convenience “at” versions are provided too, e.g., rotateAt()
        rotates around specified center.

                                        17
Dojo GFX: more details
•   All shapes are organized using an indirect Z-index.

    •   You can “move to front” and “move to back” them within a
        container.

    •   You can move the whole container.

•   Shapes can be added, removed, and transferred between containers.

•   Events are supported with familiar shape.connect() and
    shape.disconnect().
                                     18
Dojo GFX: move & fx
•   dojox.gfx.move simplifies grab-drag-drop operations.

•   dojox.gfx.fx provides animation primitives: animateStroke, animateFill,
    animateFont, and, most useful, animateTransform.

    •   It supports all matrix-producing functions of dojox.gfx.matrix.

    •   Special operation is supported: “original”, which means the original
        matrix (before animation starts).

    •   A chain of such operations can be specified.
                                       19
Dojo GFX: selecting renderers
•   Selecting specific renderers is easy: just use gfxRenderer parameter
    of dojo.config:

    •   djConfig = {gfxRenderer: “svg,vml”}.

    •   It defines the list of renderers to try.

    •   First renderer will be tried first.

    •   This way you can include/exclude renderers and their priority.

                                       20
Image Viewer
  Hacking session




        21
Simple image viewer
•   Let’s base it on public pictures available on Flickr.

    •   We can look up how to get images in dojo/tests/dnd/
        flickr_viewer.html

•   Simple functionality: preview with thumbnails, click on an image, and it
    shows it big.

    •   We may need preload big images to make our viewer snappy.

•   If time permits, let’s animate all actions.
                                        22
Dojo Charting
   The crash course




          23
Charting: major players

•   The package: dojox.charting.

•   Built on dojox.gfx, which makes it virtually browser-independent.

•   dojox.charting.Chart2D is the main object.

    •   Serves as a container for plots, axis, and data series.

    •   Uses a theme to render components, and actions to process events.


                                         24
Charting: plot
•   dojox.charting.plot2d namespace hosts Plot objects:

    •   Areas, Lines, Default (same as Lines), StackedAreas, StackedLines,
        Bubble, Candlesticks, Markers, MarkersOnly, OHLC (open-high-
        low-close chart), Pie, Scatter,

    •   Bars, ClusteredBars, StackedBars

    •   Columns, ClusteredColumns, StackedColumns

    •   Grid
                                      25
Charting: axis
•   dojox.charting.axis2d namespace hosts Axis objects:

    •   Default: linear axis with 3-level ticks, and 2-level labels.

    •   The Grid plot reuses ticks for grid lines.

•   It is possible to create plots without one or both axes.

•   Axes can be shared between plots.

•   Axes can be attached to all four sides. No stacking yet.
                                        26
Charting: data series

•   An array of numbers can be used with most plots.

    •   Bubble, Candlesticks, OHLC cannot use simple numbers.

•   An array of objects can be used to trigger an enhanced processing.

    •   Presently (10/1/2009) bar- and column-based charts cannot use
        objects. It will be fixed soon. Hopefully in time for 1.4.


                                    27
Charting: actions

•   Actions are used to process events on visual objects representing
    data points.

•   Supported events: onmouseover, onmouseout, onclick, onplotreset
    (synthetic event, used for updating a plot).

•   Common infrastructure, which simplifies creating actions.

•   Hosted by dojox.charting.action2d.

                                 28
Chart Events
  Hacking session




        29
Simple interactive chart

•   Let’s overlap two different plots on the same chart.

•   They will share the X axis, and have different Y axes.

•   We implement actions (tooltip, magnify, highlight).

•   If time permits, let’s add our own action on mouse click.



                                      30

More Related Content

Similar to Dojo GFX workshop slides (20)

Dojo GFX: SVG in the real world
Dojo GFX: SVG in the real worldDojo GFX: SVG in the real world
Dojo GFX: SVG in the real world
Eugene Lazutkin
 
Dojo javascript toolkit
Dojo javascript toolkit Dojo javascript toolkit
Dojo javascript toolkit
Predhin Sapru
 
GR8Conf 2011: STS DSL Support
GR8Conf 2011: STS DSL SupportGR8Conf 2011: STS DSL Support
GR8Conf 2011: STS DSL Support
GR8Conf
 
Better DSL Support for Groovy-Eclipse
Better DSL Support for Groovy-EclipseBetter DSL Support for Groovy-Eclipse
Better DSL Support for Groovy-Eclipse
Andrew Eisenberg
 
Dojo training
Dojo trainingDojo training
Dojo training
vadivelan_k
 
GR8Conf 2009: Practical Groovy DSL by Guillaume Laforge
GR8Conf 2009: Practical Groovy DSL by Guillaume LaforgeGR8Conf 2009: Practical Groovy DSL by Guillaume Laforge
GR8Conf 2009: Practical Groovy DSL by Guillaume Laforge
GR8Conf
 
The dedexer disassembler
The dedexer disassemblerThe dedexer disassembler
The dedexer disassembler
Gabor Paller
 
Social Networks Analysis
Social Networks AnalysisSocial Networks Analysis
Social Networks Analysis
Joud Khattab
 
How dojo works
How dojo worksHow dojo works
How dojo works
Amit Tyagi
 
Dojo and Zend Framework
Dojo and Zend  FrameworkDojo and Zend  Framework
Dojo and Zend Framework
Kuldeep Singh
 
TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!
Alessandro Giorgetti
 
So you want to liberate your data?
So you want to liberate your data?So you want to liberate your data?
So you want to liberate your data?
Mogens Heller Grabe
 
The Road to Starling 2
The Road to Starling 2The Road to Starling 2
The Road to Starling 2
Daniel Sperl
 
Android dev tips
Android dev tipsAndroid dev tips
Android dev tips
Kanda Runapongsa Saikaew
 
CeedMath & CeedGL, Let's talk 3D...
CeedMath & CeedGL, Let's talk 3D...CeedMath & CeedGL, Let's talk 3D...
CeedMath & CeedGL, Let's talk 3D...
rsebbe
 
DSL's with Groovy
DSL's with GroovyDSL's with Groovy
DSL's with Groovy
paulbowler
 
Surge2012
Surge2012Surge2012
Surge2012
davidapacheco
 
Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...
Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...
Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...
David Beazley (Dabeaz LLC)
 
Everything I Ever Learned About JVM Performance Tuning @Twitter
Everything I Ever Learned About JVM Performance Tuning @TwitterEverything I Ever Learned About JVM Performance Tuning @Twitter
Everything I Ever Learned About JVM Performance Tuning @Twitter
Attila Szegedi
 
Hands on Gradle
Hands on GradleHands on Gradle
Hands on Gradle
Mushfekur Rahman
 
Dojo GFX: SVG in the real world
Dojo GFX: SVG in the real worldDojo GFX: SVG in the real world
Dojo GFX: SVG in the real world
Eugene Lazutkin
 
Dojo javascript toolkit
Dojo javascript toolkit Dojo javascript toolkit
Dojo javascript toolkit
Predhin Sapru
 
GR8Conf 2011: STS DSL Support
GR8Conf 2011: STS DSL SupportGR8Conf 2011: STS DSL Support
GR8Conf 2011: STS DSL Support
GR8Conf
 
Better DSL Support for Groovy-Eclipse
Better DSL Support for Groovy-EclipseBetter DSL Support for Groovy-Eclipse
Better DSL Support for Groovy-Eclipse
Andrew Eisenberg
 
GR8Conf 2009: Practical Groovy DSL by Guillaume Laforge
GR8Conf 2009: Practical Groovy DSL by Guillaume LaforgeGR8Conf 2009: Practical Groovy DSL by Guillaume Laforge
GR8Conf 2009: Practical Groovy DSL by Guillaume Laforge
GR8Conf
 
The dedexer disassembler
The dedexer disassemblerThe dedexer disassembler
The dedexer disassembler
Gabor Paller
 
Social Networks Analysis
Social Networks AnalysisSocial Networks Analysis
Social Networks Analysis
Joud Khattab
 
How dojo works
How dojo worksHow dojo works
How dojo works
Amit Tyagi
 
Dojo and Zend Framework
Dojo and Zend  FrameworkDojo and Zend  Framework
Dojo and Zend Framework
Kuldeep Singh
 
TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!
Alessandro Giorgetti
 
So you want to liberate your data?
So you want to liberate your data?So you want to liberate your data?
So you want to liberate your data?
Mogens Heller Grabe
 
The Road to Starling 2
The Road to Starling 2The Road to Starling 2
The Road to Starling 2
Daniel Sperl
 
CeedMath & CeedGL, Let's talk 3D...
CeedMath & CeedGL, Let's talk 3D...CeedMath & CeedGL, Let's talk 3D...
CeedMath & CeedGL, Let's talk 3D...
rsebbe
 
DSL's with Groovy
DSL's with GroovyDSL's with Groovy
DSL's with Groovy
paulbowler
 
Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...
Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...
Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...
David Beazley (Dabeaz LLC)
 
Everything I Ever Learned About JVM Performance Tuning @Twitter
Everything I Ever Learned About JVM Performance Tuning @TwitterEverything I Ever Learned About JVM Performance Tuning @Twitter
Everything I Ever Learned About JVM Performance Tuning @Twitter
Attila Szegedi
 

More from Eugene Lazutkin (12)

Service workers
Service workersService workers
Service workers
Eugene Lazutkin
 
Advanced I/O in browser
Advanced I/O in browserAdvanced I/O in browser
Advanced I/O in browser
Eugene Lazutkin
 
Streams
StreamsStreams
Streams
Eugene Lazutkin
 
Functional practices in JavaScript
Functional practices in JavaScriptFunctional practices in JavaScript
Functional practices in JavaScript
Eugene Lazutkin
 
Express: the web server for node.js
Express: the web server for node.jsExpress: the web server for node.js
Express: the web server for node.js
Eugene Lazutkin
 
TXJS 2013 in 10 minutes
TXJS 2013 in 10 minutesTXJS 2013 in 10 minutes
TXJS 2013 in 10 minutes
Eugene Lazutkin
 
Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.
Eugene Lazutkin
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
Eugene Lazutkin
 
OOP in JS
OOP in JSOOP in JS
OOP in JS
Eugene Lazutkin
 
CRUD with Dojo
CRUD with DojoCRUD with Dojo
CRUD with Dojo
Eugene Lazutkin
 
Dojo (QCon 2007 Slides)
Dojo (QCon 2007 Slides)Dojo (QCon 2007 Slides)
Dojo (QCon 2007 Slides)
Eugene Lazutkin
 
DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
DojoX GFX Keynote Eugene Lazutkin SVG Open 2007DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
Eugene Lazutkin
 
Functional practices in JavaScript
Functional practices in JavaScriptFunctional practices in JavaScript
Functional practices in JavaScript
Eugene Lazutkin
 
Express: the web server for node.js
Express: the web server for node.jsExpress: the web server for node.js
Express: the web server for node.js
Eugene Lazutkin
 
Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.
Eugene Lazutkin
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
Eugene Lazutkin
 
DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
DojoX GFX Keynote Eugene Lazutkin SVG Open 2007DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
DojoX GFX Keynote Eugene Lazutkin SVG Open 2007
Eugene Lazutkin
 

Recently uploaded (20)

AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 

Dojo GFX workshop slides

  • 1. Advanced Dojo GFX Eugene Lazutkin, DojoToolkit.org SVG Open 2009, Mountain View, CA 1
  • 2. Dojo Toolkit: short intro • Consists of four parts: • Dojo Base – the most important part. It is included as soon as you include <script src=”dojo.js”></script>. • Dojo Core – generic core components (e.g., DnD) and a foundation for everything else. • Dijit – core widgets (form elements, layout components) to assemble UI. 2
  • 3. Dojo Toolkit: short intro • DojoX – eXtended Dojo, a repository for less frequently needed functionality. • Organized by packages. • Every package includes README listing maintainers, and external dependencies. • Can include production and experimental code (see README for each package). 3
  • 4. Dojo Toolkit: short intro • Both DojoX GFX and DojoX Charting are housed in DojoX. • Both are battle-tested, and were used in serious projects. • SVG and VML renderers were declared of production quality almost 2 years ago. • Canvas render is actively used in mobile applications. 4
  • 5. Dojo Toolkit: code • Dojo defines just three top-level objects: dojo, dijit, and dojox. Everything else is in them. • You don’t need to follow this example for simple projects. I frequently define short aliases, for example: var d = dojo, g = dojox.gfx; • Including modules are easy: dojo.require(“dojox.gfx”); 5
  • 6. Dojo Toolkit: code • Module names follow a simple convention: • Examples: dojox.gfx is in dojox/gfx.js, dijit.layout.ContentPane is in dijit/layout/ContentPane.js, and so on. • Exception: Dojo Base attaches functions directly to “dojo”, but actual code is in dojo/_base/. • Examples: dojo.style is in dojo/_base/html.js, dojo.declare is in dojo/ _base/declare.js. 6
  • 7. Dojo Toolkit: docs & help • Presently docs are hosted at Dojo Campus: • http://docs.dojocampus.org/ • Usually names are directly reflected in URL: • Docs for dojox.gfx are at http://docs.dojocampus.org/dojox/gfx • See the pattern? 7
  • 8. Dojo Toolkit: docs & help • More “interactive” help: • Mailing lists are very helpful. • Syndicated by Gmane, Nabble, Google Groups. • http://stackoverflow.com/ is frequented by users and contributors. • More “immediate” help: • #dojo channel @ freenode 8
  • 9. Dojo Toolkit: docs & help • Do not overlook “reading code”! • In most cases Dojo code is very readable and thoroughly commented. • It is a good way to learn how things work, and what API is presented. • You can spot some useful tricks from the code. • “Improving code” starts with “reading code”. If you spot a problem, open a ticket! 9
  • 10. Dojo Toolkit: docs & help • Dojo’s Trac is at http://bugs.dojotoolkit.org/ • Register your name at dojotoolkit.org. • Use Trac if you found a bug, or have a good idea for an enhancement. 10
  • 11. Dojo Toolkit: docs & help • Trac hints: • Search Trac to search for a problem before opening a ticket. • Attach files rather than pasting them inline. • If you want to post a snippet, use code formatting {{{code}}}. • Try to distill a problem into a minimal test program. • Attach patches. Tickets with patches are fast-tracked. 11
  • 12. Dojo GFX The crash course 12
  • 13. Dojo GFX: major players • The package: dojox.gfx • The proper renderer will be automatically selected. • You can change the detection order. • dojox.gfx.Surface • A rectangular container for shapes. • Usually it is anchored at <div>. 13
  • 14. Dojo GFX: shapes & groups • Shapes: Rect (with rounded corners), Circle, Ellipse, Line, Polyline, Path, Image, Text, TextPath (experimental). • dojox.gfx.Group is a special shape, which is used to group other shapes. • Its children can be enumerated. • It can be transformed as whole. • It can contain other groups. 14
  • 15. Dojo GFX: stroke & fill & font • Stroke defines how to outline a shape. • You can specify: color, thickness, style (e.g., solid or dash), caps, and joints. • Fill defines how shape’s interior is going to be filled. • Supported styles: solid color, tiled patterns, linear and radial gradient. • Font is used for Text and TextPath shapes. 15
  • 16. Dojo GFX: color • dojo.Color is used to specify all colors. • Any valid CSS3 colors are supported. • CSS named colors are supported with dojo.colors module. • Opacity is supported as well. • Warning:VML doesn’t support opacity in fills. 16
  • 17. Dojo GFX: transformations • dojox.gfx.Matrix2D is used to transform shapes. • Linear 2D transformations are supported: scaling, translation, rotation, skewing, and so on. • Practically all matrix operations are provided: multiply matrices, invert, transform points, even eigenvalue decomposition. • For convenience “at” versions are provided too, e.g., rotateAt() rotates around specified center. 17
  • 18. Dojo GFX: more details • All shapes are organized using an indirect Z-index. • You can “move to front” and “move to back” them within a container. • You can move the whole container. • Shapes can be added, removed, and transferred between containers. • Events are supported with familiar shape.connect() and shape.disconnect(). 18
  • 19. Dojo GFX: move & fx • dojox.gfx.move simplifies grab-drag-drop operations. • dojox.gfx.fx provides animation primitives: animateStroke, animateFill, animateFont, and, most useful, animateTransform. • It supports all matrix-producing functions of dojox.gfx.matrix. • Special operation is supported: “original”, which means the original matrix (before animation starts). • A chain of such operations can be specified. 19
  • 20. Dojo GFX: selecting renderers • Selecting specific renderers is easy: just use gfxRenderer parameter of dojo.config: • djConfig = {gfxRenderer: “svg,vml”}. • It defines the list of renderers to try. • First renderer will be tried first. • This way you can include/exclude renderers and their priority. 20
  • 21. Image Viewer Hacking session 21
  • 22. Simple image viewer • Let’s base it on public pictures available on Flickr. • We can look up how to get images in dojo/tests/dnd/ flickr_viewer.html • Simple functionality: preview with thumbnails, click on an image, and it shows it big. • We may need preload big images to make our viewer snappy. • If time permits, let’s animate all actions. 22
  • 23. Dojo Charting The crash course 23
  • 24. Charting: major players • The package: dojox.charting. • Built on dojox.gfx, which makes it virtually browser-independent. • dojox.charting.Chart2D is the main object. • Serves as a container for plots, axis, and data series. • Uses a theme to render components, and actions to process events. 24
  • 25. Charting: plot • dojox.charting.plot2d namespace hosts Plot objects: • Areas, Lines, Default (same as Lines), StackedAreas, StackedLines, Bubble, Candlesticks, Markers, MarkersOnly, OHLC (open-high- low-close chart), Pie, Scatter, • Bars, ClusteredBars, StackedBars • Columns, ClusteredColumns, StackedColumns • Grid 25
  • 26. Charting: axis • dojox.charting.axis2d namespace hosts Axis objects: • Default: linear axis with 3-level ticks, and 2-level labels. • The Grid plot reuses ticks for grid lines. • It is possible to create plots without one or both axes. • Axes can be shared between plots. • Axes can be attached to all four sides. No stacking yet. 26
  • 27. Charting: data series • An array of numbers can be used with most plots. • Bubble, Candlesticks, OHLC cannot use simple numbers. • An array of objects can be used to trigger an enhanced processing. • Presently (10/1/2009) bar- and column-based charts cannot use objects. It will be fixed soon. Hopefully in time for 1.4. 27
  • 28. Charting: actions • Actions are used to process events on visual objects representing data points. • Supported events: onmouseover, onmouseout, onclick, onplotreset (synthetic event, used for updating a plot). • Common infrastructure, which simplifies creating actions. • Hosted by dojox.charting.action2d. 28
  • 29. Chart Events Hacking session 29
  • 30. Simple interactive chart • Let’s overlap two different plots on the same chart. • They will share the X axis, and have different Y axes. • We implement actions (tooltip, magnify, highlight). • If time permits, let’s add our own action on mouse click. 30