In my last post, Get Me Some Video JS IdeaStrike was introduced to HTML 5 video goodness quickly, simply, and beautifully with Video.js. The New Support view provides an IdeaStrike 101 video experience leveraging HTML 5 video element and Video.js sweetness. In this installatment a review of the New Metric View will be the focus. The New Metric view leverages Raphael JS to provide an awesome, compelling, interactive user experience pie chart. Currently the Metric view only provides two pie charts; Most Ideas/Innovations and Most Votes.
Our internal Phase I is complete, leading to an evaluation period. The port to RavenDB discussed in a previous post, Project – Migrate IdeaStrike to RavenDB will commence shortly.
Phase I – New Features
- Support View – HTML 5 and Video JS provides IdeaStrike 101 quickly and simply.
- Metric View – Raphael JS provides interactive pie charts.
- Admin User Profile
- User Profile
- Public User Profile
For discussion concerning outlined phases and code changes read on.
Phase II
- Admin Tooling
- Delete Idea or Comment
- Ban User
- Comment Approval
- New Innovation Workflow
- RavenDB
Phase III
The charts listed below will be introduced in a subsequent release.
- Most Activity
- Most Comments
- Most Features
Code
As you can see the Metric View Module supports has two properties, Name
and Count
with a static method, GetPercentage to return the proper user percentage.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
As you can see the Metric Module supports two HTTP Get routes, /
or /votes
. The data, a collection of MetricViewModels is returned using LINQ query.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
Raphael.js can be downloaded here or you can install it from NuGet using Install-Package RaphaelJS
or simply view the package here. It is important to note for IdeaStrike ALL resources, *.js files included are stored in ~/Resources
. Therefore, I moved the Raphael scripts installed the NuGet package in ~/Scripts
to the ~/Resources
directory to remain consistent.
Raphael CSS References:
- pie.css
- pie-print.css
Raphael JS References:
- raphael.js
- pie.js
The raphael.js file is the main Raphael JS library. The pie.js file is specific to the pie chart functionality.
Build Chart Data
The view loops through the Model.Metrics, a collection of MetricViewModels building a table of row data in the form of user name, percentage. Each row calls a static method, MerticViewModels.GetPercentage to determine the percentage, passing in the total idea count and the metric view model count.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
It is important to note when and where the Raphael chart is created. As you can see from the code below, we ONLY execute the Raphael script after the entire DOM has been loaded, $(document).ready(function ()
. JQuery is leveraged to get the data from the HTML Table rows as arrays passing them along to the Raphael pie function to create the chart.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
The Raphael pie chart JavaScript function was taken from the Raphaeljs.com example code base.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
Support View
Metric View: Most Innovations
Metric View: Most Votes
Backlog Overview
- Categories and Tags
- Add Work Email to User Profile
- Add Work Email to Public Profile
- Groups
- Security related to groups
- Workflow Updates
- Admin Delete
- Create Idea via Yammer
- Send Idea to Yammer
- Create Idea via Email
- Send Email template to new User
- Edit own Features