Permalink
Browse files

added deployed file and screenshot

  • Loading branch information...
1 parent 325d7fc commit ca8d18740ebc5f8bcd968746492939792a1a6665 @osulehria osulehria committed Aug 28, 2012
Showing with 220 additions and 0 deletions.
  1. +220 −0 deploy/ValueRiskApp.html
  2. BIN deploy/screenshot.png
View
@@ -0,0 +1,220 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!-- Copyright (c) 2012 Rally Software Development Corp. All rights reserved -->
+<html>
+<head>
+ <title>ValueRisk</title>
+ <meta name="Name" content="App: ValueRisk"/>
+ <meta name="Version" content="2012.08.27"/>
+ <meta name="Vendor" content="Rally Software"/>
+ <script type="text/javascript" src="/apps/1.29/sdk.js?debug=true"></script>
+ <script type="text/javascript" src="https://people.rallydev.com/js/jquery.min.js"></script>
+ <script type="text/javascript" src="https://people.rallydev.com/js/highcharts.js"></script>
+ <script type="text/javascript" src="https://people.rallydev.com/js/exporting.js"></script>
+
+ <script type="text/javascript">
+ function ValueRisk() {
+ var that = this;
+ this.display = function(element) {
+ var MIN_BUBBLE_SIZE = 5;
+
+ var QUARTERS_BACK = 2;
+ var NUM_QUARTERS = 12;
+ var QUARTERS = [
+ { label: "Q4 2011", start: "2011-10-01", end: "2011-12-31" },
+ { label: "Q1 2012", start: "2012-01-01", end: "2012-03-31" },
+ { label: "Q2 2012", start: "2012-04-01", end: "2012-06-30" },
+ { label: "Q3 2012", start: "2012-07-01", end: "2012-09-30" },
+ { label: "Q4 2012", start: "2012-10-01", end: "2012-12-31" }
+ ];
+
+ var rallyDataSource = null;
+ var typeDropDown = null;
+ var quarterDropDown = null;
+
+ function renderChart(data){
+ console.log("Render chart");
+ console.log(data);
+
+ var chart = new Highcharts.Chart({
+ chart: {
+ renderTo: 'chart',
+ defaultSeriesType: 'scatter'
+ },
+ title: { text: 'Portfolio Value vs. Risk' },
+ //subtitle: { text: QUARTERS[parseInt(quarterDropDown.getValue())].label },
+ xAxis: {
+ minPadding: 0.1,
+ maxPadding: 0.1,
+ min: 0,
+ title: {
+ enabled: true,
+ text: 'Value'
+ }
+ },
+ yAxis: {
+ min: 0,
+ title: {
+ text: 'Risk'
+ }
+ },
+ tooltip: {
+ formatter: function() {
+ return '<b>'+ this.point.name +'</b><br/>'+
+ 'Value: ' + this.x +', Risk: '+ this.y +', Size: ' + this.point.size;
+ }
+ },
+ legend: {
+ layout: 'vertical',
+ style: {
+ left: '100px',
+ top: '70px',
+ bottom: 'auto'
+ },
+ backgroundColor: '#FFFFFF',
+ borderWidth: 1
+ },
+ plotOptions: {
+ scatter: {
+ marker: {
+ radius: 5,
+ symbol: 'circle',
+ states: {
+ hover: {
+ enabled: false
+ }
+ }
+ },
+ states: {
+ hover: {
+ marker: {
+ enabled: true
+ }
+ }
+ }
+ }
+ },
+ series: data
+ });
+ }
+
+ function onTypeChange( cb, args ) {
+ console.log( args );
+
+ loadData(0, args.item.TypePath);
+ }
+
+ function quarterChanged( cb, args ){
+ if( typeDropDown && typeDropDown.getValue() ) {
+ loadData(args.value, typeDropDown.getValue());
+ }
+ }
+
+ /**
+ * loadData
+ * @arg quarter the index in the quarter array. 0 == this current quarter. NOTE: Ignoring now...
+ * @arg type ref of the portfolio item type
+ */
+ function loadData(quarter, type) {
+ console.log('loading data....');
+
+ //var qObj = QUARTERS[parseInt(quarter)];
+ var queryConfig = {
+ key: 'portfolioItems',
+ type: type.replace(/\//g, '-'),
+ fetch: 'PlannedEndDate,PreliminaryEstimate,InvestmentCategory,ValueScore,RiskScore,Project,Name,FormattedID,Value',
+ order: 'InvestmentCategory'
+ //query: rally.sdk.util.Query.and([ 'Type = "'+ type + '"', 'PlannedEndDate >= "' + qObj.start + '"', 'PlannedEndDate <= "' + qObj.end + '"'])
+ };
+ rallyDataSource.findAll(queryConfig, collectResults);
+ }
+
+ function getInvestmentCategory(item){
+ if(item.InvestmentCategory === null ) {
+ return "None";
+ }
+ return item.InvestmentCategory;
+ }
+
+ function collectResults(results) {
+ console.log(results);
+
+ var series = [];
+ var currentSeries = { name: null };
+ dojo.forEach( results.portfolioItems, function(item) {
+ if( getInvestmentCategory(item) != currentSeries.name ) {
+ currentSeries = { name: getInvestmentCategory(item), data: [] };
+ series.push(currentSeries);
+ }
+ var bubbleSize = MIN_BUBBLE_SIZE;
+ var sizeText = "Unknown";
+ if ( item.PreliminaryEstimate ) {
+ bubbleSize = MIN_BUBBLE_SIZE * item.PreliminaryEstimate.Value;
+ sizeText = item.PreliminaryEstimate.Name;
+ }
+ currentSeries.data.push( { name: item.Name, x: item.ValueScore, y: item.RiskScore, size: sizeText, marker: { radius: bubbleSize } });
+ });
+
+ renderChart( series );
+ }
+
+ function onLoad() {
+ rallyDataSource = new rally.sdk.data.RallyDataSource(
+ "__WORKSPACE_OID__",
+ "__PROJECT_OID__",
+ "__PROJECT_SCOPING_UP__",
+ "__PROJECT_SCOPING_DOWN__");
+
+ rallyDataSource.setApiVersion("1.37");
+
+ /*
+ var quarters = [];
+ dojo.forEach(QUARTERS, function( q, i ) {
+ quarters.push( { label: q.label, value: i });
+ });
+ quarterDropDown = new rally.sdk.ui.basic.Dropdown({ label: 'Quarter: ', showLabel: true, items: quarters });
+ quarterDropDown.display("quarters", quarterChanged);
+ */
+
+ var typeCfg = {
+ label:'Type: ',
+ showLabel:true,
+ type: 'typeDefinition',
+ attribute:'Name',
+ order:'Ordinal desc',
+ fetch:'Ordinal,TypePath',
+ query: '((Parent.Name = "Portfolio Item") and (Creatable = true))'
+ };
+ typeDropDown = new rally.sdk.ui.ObjectDropdown(typeCfg, rallyDataSource);
+ typeDropDown.display('type', onTypeChange);
+ }
+
+ rally.addOnLoad(onLoad);
+ };
+ }
+
+ </script>
+
+ <style type="text/css">
+
+
+ </style>
+
+ <script type="text/javascript">
+
+ function onLoad() {
+ var valueRisk = new ValueRisk();
+ valueRisk.display(dojo.body());
+ }
+
+ rally.addOnLoad(onLoad);
+
+ </script>
+</head>
+<body>
+<div>
+ <span id="type"></span>&nbsp;&nbsp;<span id="quarters"></span>
+</div>
+<br/><br/>
+<div id="chart" style="height: 600px; width: 800px"></div>
+</body>
+</html>
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ca8d187

Please sign in to comment.