- Powered by Domino 8.5.2 Domino Accelerator Pack
- Take load off your Domino server
Lotus Triple Search DominoExperts + Blogs + R8 forum -> Script vault -> Java

 Visualize your domino data using Open Source java

dicklarssonPost date: 2007-03-01 09:50

Visualize your domino data using Open Source java

This code shows how easy it is to create a diagram/chart and to save it as a file.
The code asks explorer.exe to display the image. (windows only)
Its just an example, feel free to do what ever you want with it.
Great for web applications

Example image,


  1. Go to JFree.Org
  2. Download the latest version of JFreeChart
  3. Extract the files to a temp directory
  4. Create a new notes java agent.
  5. Set Runtime target to "none"
  6. Click Edit Project and add the jar files found in the temp directory where you extacted JFreeChart to your agent.
  7. Paste the code showed in Example 1
Example 1
import lotus.domino.*;
import org.jfree.chart.*;
import java.util.*;

//+46(0)706 - 33 23 68
public class JavaAgent extends AgentBase

	public void NotesMain()

			Session session = getSession();
			AgentContext agentContext = session.getAgentContext();
			HashMap map = new HashMap();
			map.put("Pierre", new Integer(178));
			map.put("Dick", new Integer(87));
			map.put("Ola", new Double(200));
			map.put("Random", new Double( (Math.random() * 200)));
			writeChartToDisk("Diagram", "c:\\test.jpg", map);

		} catch (Exception e)
	private void writeChartToDisk(String title, String fileName, Map map)
		//put map values in to a DefaultPieDataset
		Iterator iterator = map.keySet().iterator();
		DefaultPieDataset pieDataset = new DefaultPieDataset();
		while (iterator.hasNext())
			Object o =;
			Object o2 = map.get(o);
			pieDataset.setValue((String) o,  (Number) o2);
		//Create the actual chart
		JFreeChart chart = ChartFactory.createPieChart(title, pieDataset, true, true, true);
		//Write chart to disk as JPG file, and ask explorer.exe to show it.
		//You could extract the file to the html directory of the domino server or attach to a notes-document
		  	FileOutputStream fos = new FileOutputStream( fileName);
			ChartUtilities.writeChartAsJPEG(fos, 1, chart, 750, 400);
			Runtime run = Runtime.getRuntime();
			run.exec("explorer.exe  " + fileName );

		} catch (Exception e)


Nathan T FreemanPost date: 2007-03-10 01:04

You can find a demo implementation at

I used it for the basis of a fairly elaborate charting engine for a customer once.  Good stuff

Jonas IsraelssonPost date: 2007-03-11 14:12

Another great one from Dick.

RSS feed
Subscribe to Forum

Share this page

Top posters
Tomas Nielsen212
Joacim Boive27
Fredrik Stöckel27
Niklas Waller13
Kenneth Haggman11
Bryan Kuhn10
Daniel Lehtihet9
Jonas Israelsson8