Welcome to part 6 of BI with SharePoint and JavaScript. This is an ongoing series about building dashboard reports in SharePoint with just a few simple JavaScript frameworks and a Content Editor Web Part.
Here are the articles in the series.
- Simple online column chart (Demo)
- Combination charts: Stacked bar chart with line. (Demo)
- Using tabs to build a dashboard and printing reports. (Demo)
- Visualization: Packing a lot of data into a simple chart to yield maximum benefits (Demo)
- Slice and Dice data while using a page from social media to build intelligence into your reports. (Demo)
- Analytics - What If Analysis.(Demo)
- Tips for extracting, transforming and loading data for online reports.
In this article, let's look at a simple example of how to set sales targets based on What-if analysis.
As a reminder, note that the data has been hard coded into the example to keep it simple. Typically, this data would be added and maintained in a SharePoint list (or an external list ) and retrieved using SPWebservices from SharePoint.
Let's go back to the Donut sales and trend analysis from the fourth article in this series. Let's say we would like to play around with the sales data for the rest of the months in the year to figure out how much sales we need to make in order to meet year end target. For this, we can introduce a form that gets rendered with an input text box for the rest of the months. Then, we recalculate the sales figures and the trend based on the user's input and then draw the chart again.
We have used jQuery Templates again to render the input text boxes.
Notice the method to clone the array data of the original sales. This is important since otherwise the array gets copied as a shallow copy and would modify the original array each time the calculate button is clicked.
Here's the screenshot of the application in action.
Here's the link to the code and demo.
You will notice that this is a very contrived example, but this should give a sense of the complex types of reports (and reporting applications) that can be built using simple JavaScript, jQuery and a couple of popular open source frameworks.
As a reminder, note that the data has been hard coded into the example to keep it simple. Typically, this data would be added and maintained in a SharePoint list (or an external list ) and retrieved using SPWebservices from SharePoint.
Let's go back to the Donut sales and trend analysis from the fourth article in this series. Let's say we would like to play around with the sales data for the rest of the months in the year to figure out how much sales we need to make in order to meet year end target. For this, we can introduce a form that gets rendered with an input text box for the rest of the months. Then, we recalculate the sales figures and the trend based on the user's input and then draw the chart again.
We have used jQuery Templates again to render the input text boxes.
Notice the method to clone the array data of the original sales. This is important since otherwise the array gets copied as a shallow copy and would modify the original array each time the calculate button is clicked.
Here's the screenshot of the application in action.
Here's the link to the code and demo.
You will notice that this is a very contrived example, but this should give a sense of the complex types of reports (and reporting applications) that can be built using simple JavaScript, jQuery and a couple of popular open source frameworks.