SpagoBI Lesson 3: Highchart Dashboards

Business Intelligence dashboards

Every car comes with a dash board which has several gauges that alerts the driver when an important event have occurred. It might be that the car is running low on fuel or the engine oil is getting low. It might be also that the battery is nor charging or you are driving with handbrake on! An automobile dashboard need to be easy to understand and should not take time to read, remember you are driving. A good dashboard should be easy to understand and should portray relevant information. The business community copied this dashboard idea from the automobile industry. Business dashboards show at a glance the state of the business at any given time. As an example, a chart might show a comparison between sales between current quarter and the last quarter. If all sales for previous quarters are greater than current quarter, then something is definitely wrong.

Since a dashboard should be easy to read, normally only summaries are shown in dashboards. Dashboards also show trends and comparisons.

We will create our first dashboard to compare sales between current year against sales for previous year. The dashboard will be built using the highcharts library. First, we will write the Sql that will help us get the sales comparisons between current year and previous year for the Nairobi store.

Here is the result of the query:

image0011
image0031

And here is the query:

You can find the query under the dashboard folder in the CD that came with this book. It is called dash1.txt. In case you are reading this at spagolabs blog, then you can get the mysql dump and other files needed for this tutorial by writing the author at the email xogutu at gmail dot com for a small fee.

Now that we have the query, we will create the xml template that will be used by highcharts. We have included the xml below, it can be found under the dashboard folder in the CD that came with this book. The xml file is called sales_comparison.xml.

<HIGHCHART width=’80%’ height=’80%’>

<CHART zoomType=’xy’ />

<TITLE text=’Nairobi sales comparison, current year vs previous year.’ />

<SUBTITLE text=’Detail for 2011, 2010′ />

<X_AXIS alias=’current_month’ />

<Y_AXIS_LIST>

<Y_AXIS alias=’sales_previous_year’ opposite=’true’>

<LABELS>

<STYLE color=’#89A54E’ />

</LABELS>

<TITLE text=’Sales Previous Year (2010)’>

<STYLE color=’#89A54E’ />

</TITLE>

</Y_AXIS>

<Y_AXIS alias=’sales_current_year’ gridLineWidth=’0′>

<LABELS>

<STYLE color=’#4572A7′ />

</LABELS>

<TITLE text=’Sales Current Year (2011)’>

<STYLE color=’#4572A7′ />

</TITLE>

</Y_AXIS>

</Y_AXIS_LIST>

<LEGEND layout=’vertical’

align=’left’

verticalAlign=’top’

x=’120′

y=’40′

floating=’true’

borderWidth=’1′

backgroundColor=’#FFFFFF’

shadow=’true’/>

<SERIES_LIST allowPointSelect=’true’>

<SERIES name=’Sales Previous Year (2010)’ color=’#89A54E’ type=’spline’ alias=’sales_previous_year’ />

<SERIES name=’Sales Current Year (2011)’ color=’#4572A7′ type=’spline’ alias=’sales_current_year’ dashstyle=’shortdot’>

</SERIES>

</SERIES_LIST>

</HIGHCHART>

Now login to SpagoBI as the biadmin user and follow these steps to create the dash board.

1. Create a folder in SpagoBI, call it Dash Boards.

2. Click on Resources -> dataset.

3. Click on the add button.

4. On the Label, write “SalesComparisonNairobi”

5. On Name, write “SalesComparisonNairobi”

6. On Description, write “Sales comparison for Nairobi store between between current year and previous year.”

7. You should have the following once you are done.

8. Click on the Type TAB.

9. Under DataSet Type, select Query.

10. Under data source select “Sapgo BI Mysql Training”. Remember we had created this datasource previously.

11. Under Query, Paste the query in the file dash.txt on the folder dashboard.

12. You should have this once you are done.

13. Click on preview button. You should have the output shown below.

14. Save the data set.

15. Click on Analytical Model -> Documents Development.

16. Click on Insert. Add create the document as shown below.

17. Click on browse and select the sales_comparison.xml file we created previously. The file can be found on the CD that came with this book under dashboard folder.

18. Under documents template, select “Dash Boards” and click Save.

19. Click on “Home Page”

20. Navigate to “Dash Boards” folder. Click on “Sales Comparison” document to run it.

You should have your first chart!

Now let us look at sales_comparison.xml file to better understand it.

A. Chart Size.

The first element must be HIGHCHART. You can also specify the size of the chart in this element.

<HIGHCHART width=’80%’ height=‘80 %’>

B. TITLE and SUBTITLE.

The TITLEand SUBTITLE elements are the title and subtitle of the charts.

<TITLE text=’Nairobi sales comparison, current year vs previous year.’ />

<SUBTITLE text=’Detail for 2011, 2010′ />

C. The X_AXIS element.

The element <X_AXIS alias=’current_month’ /> is the label of the X axis. In Spago Bi, this can come from a column in your data set query.

In our chart, the labels come from the database column current_month from the dataset SalesComparisonNairobi we created previously.

The contents of current_ month column in the data set SalesComparisonNairobi through the xml element <X_AXIS alias=’current_month’ /> is used to label the x axis with January up to December on our chart.

D.

Y_AXIS_LIST Element.

The <Y_AXIS_LIST> element defines the items that appear on the Y axis. Normally they come from database tables or views through the SpagoBi data set. For example, in the block of xml code below:

1. Alias element.
alias=’sales_previous_year’ – This defines which column in the dataset query the data comes from.

opposite=’true’ – When opposite is true, the label will appear on the right. When false it appears on the left.

As an example, if we say opposite is false as shown below,

The Y axis elements will be on the left.

Change it to opposite=true and the Y axis items will appear on right.

gridLineWidth=’1′ – Use 0 if you do not need a grid line.

2. The <TITLE text=’Sales Current Year (2011)’> element.

This element is used to set the labels of the items on the Y axis.

E. The LEGEND element determines the position, color and other properties of the legend.

The above block of code produces the legend below.

F.

The SERIES_LIST element is the main contents of the chart. It can be line or column.

Since our chart has two lines, it therefore will have two series. The contents of the series come from a table column through the Spago BI dataset. For example, the dottet series (Sales for 2011) comes from the column sales_current_year and the element dashstyle=’shortdot’ makes it dotted. The element type=’spline’ means a line chart, if we change it to type=’column’ , we will end up with a bar graph as shown:

SpagoBI 教程 Lesson 3: Highchart Dashboards的更多相关文章

  1. SpagoBI 教程 Lesson 2: OLAP with JPIVOT

    SpagoBI Lesson 2: OLAP with JPIVOT Online Analytical Processing Online Analytical Processing (OLAP) ...

  2. SpagoBI 教程 Lesson 5: Creating a dashboard with BIRT and SpagoBI

    SpagoBI Lesson 5: Creating a dashboard with BIRT and SpagoBI Creating a dashboard with BIRT and Spag ...

  3. SpagoBI 教程 Lesson 4: BIRT Reports

    SpagoBI Lesson 4: BIRT Reports BIRT BIRT is the acronym for Business Intelligence and Reporting Tool ...

  4. SpagoBI 教程 Lesson 1:Introduction and Installation

    SapgoBI Lesson 1: Introduction and Installation Downloading and installing SpagoBI. Download SpagoBI ...

  5. 教程:SpagoBI开源商业智能之XML Template 图表模板

    SpagoBI offers a variety of widgets' examples realized with the Highcharts library, that can be divi ...

  6. 教程:Spagobi开源BI系统 Console报表设计教程

    Console Designer 1 Console Designer Console Designer 1.1 Introduction 1.2 Dataset Tab 1.3 Summary Pa ...

  7. Lazy的SDL教程 翻译----Lesson 22 Timing

    原文:http://lazyfoo.net/tutorials/SDL/22_timing/index.php Timing 计时 Last Updated 3/10/14 Another impor ...

  8. Highchart基础教程-图表配置

    一.图表容器: Highcharts 实例化中绑定容器的两种方式: 1.通过 dom 调用 highcharts() 函数的方式 $("#container").highchart ...

  9. Highchart基础教程-图表的主要组成

    一.Highchar图表的主要组成 1.图表标题(Title):图表包含标题和副表题(subTitle,可选). 2.坐标轴(Axis):包括x轴(xAxis)和y轴(yAxis).多个数据列可以共同 ...

随机推荐

  1. distinct aggregation

    https://docs.google.com/document/d/1zj6OA-K2hi7ah8Fo-xTQB-mVmYfm6LsN2_NHgTCVmJI/edit# https://issues ...

  2. 高级数据库及一步一步搭建versant数据库

    总的来说,高级数据库课程分为分布式数据库和面向对象数据库两块.分布式数据库介绍了分布式数据库的方方面面,包括数据库系统的设计.查询处理优化.事务管理和恢复.并发控制.可靠性.安全性与目录管理等.面向对 ...

  3. sql server2000导出表结构说明

    SELECT 表名 then d.name else '' end, 表说明 then isnull(f.value,'') else '' end, 字段序号=a.colorder, 字段名=a.n ...

  4. 每日英语:China Bond Trading Dives

    SHANGHAI—Trading volume in China's bond market has plummeted in recent months, in another reminder o ...

  5. 关键词抽取:pagerank,textrank

    摘抄自微信公众号:AI学习与实践 TextRank,它利用图模型来提取文章中的关键词.由 Google 著名的网页排序算法 PageRank 改编而来的算法. PageRank PageRank 是一 ...

  6. DIOCP开源项目-DIOCP3直接发送对象,帮你处理粘包问题

    该DEMO演示,如何在客户端与服务端之间直接传递TStream对象,让你专注于处理数据逻辑,可以忽略处理网络传输间粘包的问题. 上面由服务端向所有的客户端推送一个消息TMemoryStream对象(该 ...

  7. Lua 自己实现排序sort比较方法,抛出错误invalid order function for sorting

    明天新功能就要上了,结果刚刚突然QA说项目抛出了错误.握草,吓得立马出了一身汗. 查了一下错误,发现可能是自己写的不稳定排序造成的.自己感觉应该就是.把排序方法写成稳定的之后,代码分离编译进手机,跑了 ...

  8. 导入第三方Jar包到Nexus私服

    公司里面有自己的公共代码库,如果希望交给Maven进行管理,可以搭建Nexus服务器,将公司的公共代码库的代码打成jar包,然后上传到Nexus私服服务器上,项目组的成员就可以在Maven项目中通过添 ...

  9. 【转载】一个Sqrt函数引发的血案

    转自:http://www.cnblogs.com/pkuoliver/archive/2010/10/06/sotry-about-sqrt.html 源码下载地址:http://diducoder ...

  10. 基于jquery鼠标点击图片翻开切换效果

    基于jquery鼠标点击图片翻开切换效果是一款基于jQuery+CSS3实现的点击图片切换特效.效果图如下: 在线预览   源码下载 实现的代码. html代码: <div class=&quo ...