Dojo Charting in XPages
Dojo Charting in XPages
Dojo Charting in XPages
Andrew Champion
Speaker Introduction
Andrew Champion
Based in the North of UK
Certified Lotus Notes Developer since 1997
Developing XPages Applications since 2009
Lead Developer, FoCul Ltd. www.focul.net
Solutions for Engineering & Manufacturing Industries
Blogs at www.andrewchampion.me.uk
But not nearly enough
Session Introduction
You are familiar with
Notes and Domino
Developing and deploying XPages applications
Server Side and Client Side JavaScript in XPages
Agenda
Creating a Dashboard
With a reusable custom control
Q&A
Agenda
Creating a Dashboard
With a reusable custom control
Q&A
XPages Version
Dojo Version
Dojo 1.1.1
Notes/Domino 8.5.1
Dojo 1.3.2
Notes/Domino 8.5.2
Dojo 1.4.1
Notes/Domino 8.5.3
Dojo 1.6.1
Dojo 1.8.1
Agenda
Creating a Dashboard
With a reusable custom control
Q&A
dojox.charting Library
The Dojo Toolkit is divided into several main packages
dojo: The core covers a wide range of funtionality such as AJAX and DOM manipulation, events
and internationalisation libraries.
dijit: Built fully on top of the dojo core and contains an extensive set of user interface controls
(widgets) such as text boxes and modal dialogs
dojox: Historically an area for development of additional dojo functionality. Built upon both the
dojo core and dijit packages.
Modules and sub-packages have a status of Mature, Experimental, Maintained, Deprecated
or Abandoned
dojox.charting is Mature
util: Various tools that support the rest of the toolkit such as being able to build, test and
document code.
dojox.charting module provides a way to quickly and easily add great looking
charts to web pages. All that is needed is...
A copy of dojo (provided by XPages)
Some JavaScript skills (provided by you!)
dojox.charting Library
Then you can create charts such as these* ....
*not today(!) were starting out with some simple examples to get you started.
Agenda
Creating a Dashboard
With a reusable custom control
Q&A
There is a very demanding Managing Director who wants to visually inspect the
number of orders, the best selling products and the performance of the sales
reps.
Agenda
Creating a Dashboard
With a reusable custom control
Q&A
};
XSP.addOnLoad(makeCharts);
Demo Time
pieChart.addPlot("default", {type: "Pie", radius: 150, fontColor: "black", labels: false}); //Add the plot
pieChart.addSeries("Number of Orders", jsonData); //Add the data series
pieChart.setTheme(dojoTheme);
pieChart.render();
//Add a legend
Agenda
Creating a Dashboard
With a reusable custom control
Q&A
Demo Time
Demo Time
Area Chart
Can be created almost identically to a bar chart some different settings such as markers
Agenda
Creating a Dashboard
With a reusable custom control
Q&A
Creating a Dashboard
Wouldnt it be nice if we could set up a dashboard page with different charts?
Create a re-usable custom control
Custom properties for
Chart type
Data series and label array(s)
Boolean values to indicate if we want a legend, tooltip or animation
Click through Xpage to underlying data
http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=You
AtNotes%20xCharting
http://www.juliusbuss.de/
Chart Custom
Control
Chart Custom
Control
Dashboard XPage
Chart Custom
Control
Demo Time
Use java classes to extract the data and store this in a managed bean
Depending on use case the bean can be bound to application or session scope
Data does not have to be recalculated every time the dashboard is opened
Methods to refresh the data and rebuild the dashboard
Other useful methods will be to sort the data (largest first) and return a subset , e.g. top 10
1. Set up the XPage for dojo with dojoParseOnLoad = true dojoTheme = true
2. Include the required dojo modules
3. Add an empty div container for the chart
4. Provide the data for the chart in an array of JSON values (we used SSJS)
5. Create the chart using CSJS
Agenda
Creating a Dashboard
With a reusable custom control
Q&A
Useful Resources
Dojo website
http://dojotoolkit.org/
With a very good reference guide