Here's Sales report of an ogranization by day. Wouldn't it be great if we can plot this on a calendar and higlight the day when it's holiday.
Prerequisites:
To render the calendar we will need mooTools Core, mooTools More and mooTools events calendar. Here are URLs for download: (I used No Compression for all downloads)
MooTools Core: http://mootools.net/download
MooTools More: http://mootools.net/more
Select Date, Scroller, Tips while downloading mooTools More.
Events Calendar: http://dansnetwork.com/mootools/events-calendar/download/
Here's the list of all files you should have after download:
- mooECal.css
- mooECal.js
- mooECalLarge.css
- mooECalSmall.css
- mootools-1.2.4-core-nc.js
- mootools-1.2.4.4-more.js
Narrative View to render Calendar
I added Narrative View to the report I showed earlier.
Added following information to each textbox and selected "Contains HTML Markup" checkbox.
Prefix:
<link rel="stylesheet" type"text/css" href="./res/mooTools/mooECal.css">
<script language="javascript" src="./res/mooTools/mootools-1.2.4-core-nc.js"></script>
<script language="javascript" src="./res/mooTools/mootools-1.2.4.4-more.js"></script>
<script language="javascript" src="./res/mooTools/mooECal.js"></script>
<div id="calBody"></div>
<script language="javascript">
function getDiv(holFlag)
{
if(holFlag=='Y')
{
return '<div style="background-color:#990000;color:#ffffff;">';
}
else
{
return '<div>';
}
}
new Calendar({calContainer:'calBody', newDate:'1/21/2010',
cEvents:new Array(
Narrative:
{
title: getDiv('@3') + '@4</div>',
start: '@2',
end: '@2',
location: ''
}
Row Separator:
,
Postfix:
)
}); </script>
Please note:
- The path to .js and .css files is ./res/mooTools.
- getDiv function returns div tag with red background when it's holiday. You can do other event specific handling if required.
- Calendar instance is passed an array of events. In our case this is sales information.
Sales value is passed in the title. Start and End date are sale date. - The comma (,) in Row separator will separate event array element.
- You can change mooECal.css in prefix section to mooECalSmall.css or mooECalLarge.css if you want smaller or bigger calendar.
Here's data rendered on calendar. Note, background color for holidays.
Please read licensing terms of mooTools and event calendar before making commercial use.
Nice article thanks for sharing with us.
ReplyDeleteNice! Very Nice!
ReplyDeleteJohn
http://obiee101.blogspot.com/
Hey John,
DeleteDid you try this in 11g? Can you tell me to which folder should i copy in 11g?
Hitesh,
ReplyDeleteI was searching for the same since long time. It is really very use full for me.
Thank you very much…
Venkat
Wonderful...Thanks a lot Hitesh
ReplyDeleteSheeba.T
Great Job Hitesh
ReplyDeleteRaja V (Anjali)
can't make this work in 11g Calendar is undefined error
ReplyDeleteThis is really good article, thanks for sharing
ReplyDeleteGood one. I will definitely try this.
ReplyDeleteWhat is holFlag ? DashBoard is not showing anything. Please any one explain how work flow of given function
ReplyDeletefunction getDiv(holFlag)
and from where it takes value for holFlag ?