Fetch CSV records into Chart

Google Chart API

System Requirements:

Download Domino Designer 8.5.3 Environment (DDE)

Download /Make available Google Chart API

Download jQuery-csv (jQuery Plugin) / jquery.csv-0.71 / jquery.csv-0.71.min


Load CSV records to charts using Google Chart API. Create a JavaScript file in WebContent, load chart data to browser via Xpages. Build a connection to a Lotus Notes Domino Database located on C Drive to get started...


Information contained in the following is presented as is. This tutorial assumes you have basic programming knowledge. All tutorials are based on an Eclipse/Eclipse-based software. Should you need to familiarize yourself with a certain Eclipse environment, prior to continuing this tutorial, please stop now and see our Tutorials page...

Save JavaScript to WebContent

At this point we assume Domino Designer 8.5.3, Google Chart API, and the jQuery CSV plugin are available/installed in your environement. Create an Xpages form, plug a reference to the JavaScript and load Google Charts to user.


// @author: Dököll Solutions, Inc.

// Program: myjquerybarchartsregdata.js

// Created from copy: 2013.

// load the visualization library from Google and set a listener

google.load("visualization", "1", {packages:["corechart"]});


function drawChart() {

// grab the CSV

$.get("TutsDataForJSCharts.csv", function(csvString) {

// transform the CSV string into a 2-dimensional array

var arrayData = $.csv.toArrays(csvString, {onParseValue: $.csv.hooks.castToScalar});

// use arrayData to load the select elements with the appropriate options

for (var i = 0; i < arrayData[0].length; i++) {

// this adds the given option to both select elements

$("select").append("<option value='" + i + "'>" + arrayData[0][i] + "</option");


// set the default selection

$("#domain option[value='0']").attr("selected","selected");

$("#range option[value='1']").attr("selected","selected");

// this new DataTable object holds all the data

var data = new google.visualization.arrayToDataTable(arrayData);

// this view can select a subset of the data at a time

var view = new google.visualization.DataView(data);


var options = {

title: " Programming Tutorial Code Samples By Type",

hAxis: {title: data.getColumnLabel(0), minValue: data.getColumnRange(0).min, maxValue: data.getColumnRange(0).max},

vAxis: {title: data.getColumnLabel(1), minValue: data.getColumnRange(1).min, maxValue: data.getColumnRange(1).max},

legend: 'none'


var chart = new google.visualization.BarChart(document.getElementById('chart'));

chart.draw(view, options);

// set listener for the update button


// determine selected domain and range

var domain = +$("#domain option:selected").val();

var range = +$("#range option:selected").val();

// update the view


// update the options

options.hAxis.title = data.getColumnLabel(domain);

options.hAxis.minValue = data.getColumnRange(domain).min;

options.hAxis.maxValue = data.getColumnRange(domain).max;

options.vAxis.title = data.getColumnLabel(range);

options.vAxis.minValue = data.getColumnRange(range).min;

options.vAxis.maxValue = data.getColumnRange(range).max;

// update the chart

chart.draw(view, options);




Create CSV file and place in WebContent

You will now create a CSV file with the following column coordinates: CodeName, Quantity, Downloads, Rating, Response, Inventory. You want to fill these columns with data to be read into Google charts. Firstly, add the following, or your choosing, to the CodeName column/rows (1) CSS, (2) LSAgent (3) Java (4) JavaAgent (5) XML, lastly add integer values to Quantity, Downloads, Rating, Response, Inventory respectively to column/rows.

Create Xpages form/Embed HTML Code:

Make available the Google Chart API code via HTML code within Xpages form and show chart to user. Be sure to place the CSV file to the WebContent folder at this point or your choosing; simply change the code to locate the file if adding to a server or subfolders.


<?xml version="1.0" encoding="UTF-8"?>

<xp:view xmlns:xp="">



<title>Dököll Solutions, Inc. Tutorials (Bar)</title>

<script src=""></script>

<script src=""></script>

<script src="jquery.csv-0.71.js"></script>

<script src="/sitefindermobile.nsf/myjquerygbarchartsregdata.js"></script>




<h1>Dököll Solutions, Inc. Tutorials</h1>

<h3>Tutorials By Type</h3>


<div id="chart" style="width:800px; height:500px;">


<h3>Choose: Quantity, Downloads, Rating, Response, Inventory</h3>



<select id="range">

<option value="" >Select Quantity</option>


<select id="domain" disabled="disabled">

<option value="" >Select CodeName</option>






Hover Charts to visualize data:

See pop up references to the data included in the Google Charts by hovering on the respective Bar Chart column. If you are not see your chart, it may be because your CSV file cannot be found. Be sure to place the CSV file to the WebContent folder at this point or your choosing; simply change the code to locate the file if adding to a server or subfolders.

Bar/Pie Chart Screenshot:


While you can Repeat the above process to create a Pie Chart, using same CSV file, creating a scattered chart, as one example, will need additional programming on your part. Please visit the Google Chart API webpage for more info:

Questions, comments, please post a brief message on our Contact form on the main site.

Follow Us: @DokollSolutions |

or Like Us: Dököll Solutions, Inc. |

Thank you for coming...