SpagoBI offers a variety of widgets' examples realized with the Highcharts library, that can be divided according to the characteristics, in the following categories:

一、Bar

 

XML Template

<HIGHCHART>
<CHART type='bar'/>
<TITLE text='Sales by Region'/>
<SUBTITLE text='USA Countries' />
<X_AXIS title='States' alias='sales_state'/>
<Y_AXIS min='0'>
<TITLE text='Sales - Cost Amount' align='high'/>
</Y_AXIS>
<LEGEND layout='vertical'
align='right'
verticalAlign='top'
x='-100'
y='100'
floating='true'
borderWidth='1'
backgroundColor='#FFFFFF'
shadow='true'/>
<PLOT_OPTIONS>
<BAR>
<DATA_LABELS enable='true'/>
</BAR>
</PLOT_OPTIONS>
<SERIES_LIST>
<SERIES name="Store sales" alias="store_sales" />
<SERIES name="Store cost" alias="store_cost" />
</SERIES_LIST>
</HIGHCHART>

二、Pies

  • 1 Simple Pie

    • 1.1 Template
  • 2 Double Pie
    • 2.1 Template
  • 3 Pie with legend
    • 3.1 Template

1 Simple Pie

1.1 Template

<HIGHCHART  width='100%' height='100%'>
<CHART type='pie' defaultSeriesType='pie'/>
<TITLE text='Browser market shares at a specific website, 2010' />
<SUBTITLE text='Simple subtitle' />
<PLOT_OPTIONS >
<PIE allowPointSelect='true' cursor='pointer' >
<DATA_LABELS enabled='true' color='#000000' connectorColor='#000000'/>
</PIE>
</PLOT_OPTIONS>
<SERIES_LIST>
<SERIES type='pie' name='Browser share' alias='MEDIA,VALUE'/>
</SERIES_LIST>
<LEGEND layout='vertical'
align='right'
verticalAlign='top'
x='-100'
y='100'
floating='true'
borderWidth='1'
backgroundColor='#FFFFFF'
shadow='true'/>
</HIGHCHART>

2 Double Pie

Note: It shows two different series values and it's usefull to compare their. For example the same data about two different years.

2.1 Template

<HIGHCHART  width='100%' height='100%'>
<CHART margin='[50, 0, 0, 0]' plotBackgroundColor='none' plotBorderWidth='0' plotShadow='false' />
<TITLE text='Sales and Costs - Market Shares for Product Departments' />
<SUBTITLE text='Sales and Costs of ${ProdFamily} in ${State}' />
<!-- defines a personal palette of colors -->
<COLORS_LIST>
<COLORS color="#058DC7, #50B432, #ED561B, #DDDF00, #24CBE5, #64E572, #FF9655, #FFF263, #6AF9C4"/>
</COLORS_LIST> <SERIES_LIST>
<SERIES name='Sales' type='pie' size='45%' innerSize='20%' alias='DEPARTMENT,SALES' >
<DATA_LABELS enabled='false'/>
</SERIES>
<SERIES name='Costs' type='pie' innerSize='45%' alias='DEPARTMENT,COSTS' >
<DATA_LABELS enabled='true' color='#000000' connectorColor='#000000'/>
</SERIES>
</SERIES_LIST>
<TOOLTIP backgroundColor='#FCFFC5' crosshairs='true' enabled='true' shadow='true' />
</HIGHCHART>

3 Pie with legend

3.1 Template

<HIGHCHART  width='100%' height='100%'>
<CHART type='pie' defaultSeriesType='pie'/>
<TITLE text='Browser market shares at a specific website, 2010'/>
<SUBTITLE text='Simple subtitle' />
<PLOT_OPTIONS >
<PIE allowPointSelect='true' cursor='pointer' showInLegend='true'>
<DATA_LABELS enabled='false'/>
</PIE>
</PLOT_OPTIONS>
<SERIES_LIST>
<SERIES type='pie' name='Browser share' alias='MEDIA,VALUE'/>
</SERIES_LIST>
<LEGEND layout='vertical'
align='right'
verticalAlign='top'
x='-100'
y='100'
floating='true'
borderWidth='1'
backgroundColor='#FFFFFF'
shadow='true'/>
</HIGHCHART>

三、Scatter(散点图)

Template

<HIGHCHART  width='100%' height='100%'>
<CHART type='scatter' defaultSeriesType='scatter' zoomType='xy' backgroundColor='white'/>
<TITLE text='Sales versus Costs' />
<SUBTITLE text='Detail for month' />
<X_AXIS startOnTick='true' endOnTick='true' showLastLabel='true'>
<TITLE text='Sales' enabled='true'/>
</X_AXIS>
<Y_AXIS>
<TITLE text='Costs'/>
</Y_AXIS>
<LEGEND layout='vertical'
align='right'
verticalAlign='top'
x='-100'
y='100'
floating='true'
borderWidth='1'
backgroundColor='#FFFFFF'
shadow='true'/>
<PLOT_OPTIONS >
<SCATTER>
<MARKER radius='5'>
<STATES>
<HOVER enabled='true' lineColor='rgb(100,100,100)'/> </STATES>
</MARKER>
</SCATTER>
</PLOT_OPTIONS>
<SERIES_LIST allowPointSelect='true'>
<SERIES name='Sales' color='rgba(223, 83, 83, .5)' alias='THE_MONTH,SALES' />
<SERIES name='Costs' color='rgba(119, 152, 191, .5)' alias='THE_MONTH,COSTS' />
</SERIES_LIST>
</HIGHCHART>

四、Lines

  • 1 Simple Line

    • 1.1 Template
  • 2 Area Line
    • 2.1 Template
  • 3 Dual Axis Line
    • 3.1 Template
  • 4 Multi Axis Line
    • 4.1 Template

1 Simple Line

1.1 Template

<HIGHCHART  width='80%' height='80%'>
<CHART type='line' zoomType='x'/>
<TITLE text='Monthly Average Temperature' />
<SUBTITLE text='Source: WorldClimate.com' />
<PLOT_OPTIONS >
<LINE enableMouseTracking='true'>
<DATA_LABELS enabled='true'/>
</LINE>
</PLOT_OPTIONS>
<SERIES_LIST>
<SERIES name='London' alias='VALUE' />
</SERIES_LIST>
<X_AXIS/>
<Y_AXIS>
<TITLE text='Temperature (¶øC)'/>
</Y_AXIS>
<LEGEND enabled='false'/>
</HIGHCHART>

2 Area Line

2.1 Template

<HIGHCHART>
<CHART type='line' defaultSeriesType='line' zoomType='x' spacingRight='20'/>
<TITLE text='USD to EUR exchange rate from 2006 through 2008' />
<SUBTITLE text='Click and drag in the plot area to zoom in' />
<PLOT_OPTIONS >
<AREA lineWidth='1' shadow='false'>
<FILL_COLOR linearGradient='[0, 0, 0, 300]'>
<STOPS_LIST>
<STOPS>[0, 'rgb(69, 114, 167)']</STOPS>
<STOPS>[1, 'rgba(2,0,0,0)']</STOPS>
</STOPS_LIST>
</FILL_COLOR>
</AREA>
</PLOT_OPTIONS>
<SERIES_LIST>
<SERIES name='USD to EUR' type='area' pointInterval='8640000' pointStart='1123459200000' alias='VALUE' />
</SERIES_LIST>
<X_AXIS maxZoom='8640000' type='datetime'/>
<Y_AXIS min='0.6' startOnTick='false' showFirstLabel='false'>
<TITLE text='Exchange rate'/>
</Y_AXIS>
<LEGEND enabled='false'/>
</HIGHCHART>

Note: pay your attention to the category axis (x) settings. Its values are created automatically by the Highcharts library using the configuration setted into the SERIES tag (pointInterval and pointStart configure the X_AXIS that is defined as 'datetime' type). So the xAxis value aren't got by a dataset column. It's usefull when you are sure that the data follow the regular datetime values generated.

3 Dual Axis Line

3.1 Template

<HIGHCHART  width='80%' height='80%'>
<CHART zoomType='xy' />
<TITLE text='Sales vs Costs' />
<SUBTITLE text='Detail for month' />
<X_AXIS alias='THE_MONTH' />
<Y_AXIS_LIST>
<Y_AXIS alias='SALES'>
<LABELS>
<STYLE color='#89A54E' />
</LABELS>
<TITLE text='Sales'>
<STYLE color='#89A54E' />
</TITLE>
</Y_AXIS> <Y_AXIS alias='COSTS' opposite='true'>
<LABELS>
<STYLE color='#4572A7' />
</LABELS>
<TITLE text='Costs'>
<STYLE color='#4572A7' />
</TITLE>
</Y_AXIS> </Y_AXIS_LIST>
<LEGEND layout='vertical'
align='left'
verticalAlign='top'
x='120'
y='100'
floating='true'
borderWidth='1'
backgroundColor='#FFFFFF'
shadow='true'/>
<SERIES_LIST allowPointSelect='true'>
<SERIES name='Sales' color='#4572A7' type='column' yAxis='1' alias='SALES' />
<SERIES name='Costs' color='#89A54E' type='spline' alias='COSTS' />
</SERIES_LIST>
</HIGHCHART>

4 Multi Axis Line

4.1 Template

<HIGHCHART  width='80%' height='80%'>
<CHART zoomType='xy' />
<TITLE text='Sales, Costs and Unit sales' />
<SUBTITLE text='Detail for month' />
<X_AXIS alias='THE_MONTH' />
<Y_AXIS_LIST>
<Y_AXIS alias='SALES' opposite='true'>
<LABELS>
<STYLE color='#89A54E' />
</LABELS>
<TITLE text='Sales'>
<STYLE color='#89A54E' />
</TITLE>
</Y_AXIS>
<Y_AXIS alias='COSTS' gridLineWidth='0'>
<LABELS>
<STYLE color='#4572A7' />
</LABELS>
<TITLE text='Costs'>
<STYLE color='#4572A7' />
</TITLE>
</Y_AXIS>
<Y_AXIS alias='UNIT_SALES' gridLineWidth='0' opposite='true'>
<LABELS>
<STYLE color='#AA4643' />
</LABELS>
<TITLE text='Unit Sales'>
<STYLE color='#AA4643' />
</TITLE>
</Y_AXIS>
</Y_AXIS_LIST>
<LEGEND layout='vertical'
align='left'
verticalAlign='top'
x='120'
y='80'
floating='true'
borderWidth='1'
backgroundColor='#FFFFFF'
shadow='true'/>
<SERIES_LIST allowPointSelect='true'>
<SERIES name='Sales' color='#89A54E' type='column' yAxis='1' alias='SALES' />
<SERIES name='Costs' color='#4572A7' type='spline' alias='COSTS' dashStyle='shortdot' yAxis='2'>
<MARKER enabled="false"/>
</SERIES>
<SERIES name='Unit Sales' color='#AA4643' type='spline' alias='UNIT_SALES' />
</SERIES_LIST>
</HIGHCHART>

五、Master Detail

This is a particular chart, different by the standard. It's composed by two charts: the summary (below) and the detail (top).
They show the same data but with different aggregation levels. All informations are got by the dataset. The engine doesn't make operation of aggregation.
In this example the summary or master shows data monthly while the detail shows the daily detail. 
Is possible to use a slider (zoom) on the master to change the range of the detail chart.

At the moment, this type of chart is available with line charts on simple xy axis. Multiserie are managed.

Template

<HIGHCHART  width='80%' height='60%'>
<CHART type='line' subType='MasterDetail' zoomType='x'/>
<TITLE text=' ' />
<SUBTITLE text=' ' />
<PLOT_OPTIONS >
<AREA lineWidth='1' shadow='false'>
<FILL_COLOR linearGradient='[0, 0, 0, 300]'>
<STOPS_LIST>
<STOPS>[0, '#4572A7']</STOPS>
<STOPS>[1, 'rgba(0,0,0,0)']</STOPS>
</STOPS_LIST>
</FILL_COLOR>
</AREA>
</PLOT_OPTIONS>
<SERIES_LIST allowPointSelect='true' >
<SERIES name='Store sales' type='area' alias='month_utc,sales_for_month' />
<SERIES name='Store costs' type='area' alias='month_utc,costs_for_month' />
</SERIES_LIST>
<X_AXIS type='datetime' endOnTick='true' showLastTickLabel='false' maxZoom='2678400000' >
<PLOT_BANDS_LIST >
<PLOT_BANDS id='mask-before' from='Date.UTC(1998,0,1)' to='Date.UTC(1998,7,1)' defaultMax='Date.UTC(1998,11,31)' color='rgba(0, 0, 0, 0.2)' />
</PLOT_BANDS_LIST>
</X_AXIS>
<Y_AXIS >
<LABELS enabled='true'/>
<TITLE text=' '/>
</Y_AXIS>
<TOOLTIP enabled='true'/>
<LEGEND enabled='false'/> <DETAIL_CHART>
<CHART type='line' zoomType='x'/>
<TITLE text='Store costs vs Store sales' />
<SUBTITLE text='Select an area by dragging across the lower chart' />
<PLOT_OPTIONS >
<LINE enableMouseTracking='true'>
<DATA_LABELS enabled='false'/>
</LINE>
</PLOT_OPTIONS>
<X_AXIS type='datetime' maxZoom='0.1'>
<LABELS enabled='true'/>
<TITLE text=' '/>
</X_AXIS>
<Y_AXIS maxZoom='0.1'>
<LABELS enabled='true'/>
<TITLE text=' '/>
</Y_AXIS>
<LEGEND layout='vertical'
align='left'
verticalAlign='top'
floating='true'
borderWidth='1'
backgroundColor='#FFFFFF'
shadow='true'/>
<TOOLTIP enabled='true'/>
<SERIES_LIST allowPointSelect='false' >
<SERIES name='Store costs' color='rgba(223, 83, 83, .5)' alias='the_date,store_cost' type='line' >
<MARKER enabled='false'>
<HOVER enabled='true' radius='3' />
</MARKER>
</SERIES>
<SERIES name='Store sales' color='rgba(119, 152, 191, .5)' alias='the_date,store_sales' type='line' >
<MARKER enabled='false'>
<HOVER enabled='true' radius='3' />
</MARKER>
</SERIES>
</SERIES_LIST>
</DETAIL_CHART>
</HIGHCHART>

Pay attention to 'subType' property. It's necessary set it to 'MasterDetail' to create a master-detail chart.

Also the 'height' property is important. It specifies the detail height. The master height is calculated as 1/3 of the summary.

Dataset

For this example is very important that the dataset returns the date values in milliseconds format because in this way is possible to use the 'datetime' type for the axis X.

Here an example of the data returned for this document (pay attention to month_utc and the_date values: they are in milliseconds!):

六、Waterfall

 

Dataset

XML Template

<HIGHCHART width="100%" height="100%" >
<CHART type="waterfall" />
<TITLE text="Unit sales" color="#325072"/>
<SUBTITLE text= "" />
<COLORS_LIST>
<COLORS color="#058DC7" upColor="#8bbc21" downColor="#492970" sumColor="#0d233a"/>
</COLORS_LIST>
<LEGEND enabled='false'/>
<X_AXIS alias='state' type='category' >
<TITLE text= "" />
</X_AXIS>
<Y_AXIS_LIST>
<Y_AXIS min="0" lineWidth="1" alias='value' >
<TITLE text= "Values" />
<PLOT_LINES_LIST>
<PLOT_LINES color="#8bbc21" width="2" value="51" />
</PLOT_LINES_LIST>
</Y_AXIS>
</Y_AXIS_LIST>
<PLOT_OPTIONS>
<WATERFALL enableMouseTracking='true'>
<DATA_LABELS enabled='false' >
<STYLE color='#FFFFFF' fontWeight='bold' fontSize='12px' padding='2px' />
</DATA_LABELS>
</WATERFALL>
</PLOT_OPTIONS>
<SERIES_LIST>
<SERIES alias="state,store_sales" isIntSumAlias="isintermediatesum" isSumAlias="issum" colorAlias="color" />
</SERIES_LIST>
<TOOLTIP backgroundColor='#FCFFC5' enabled='true' shadow='true' text=' {CATEGORY} - {SERIE_NAME} : {SERIE}' >
<STYLE color='#4572A7' fontSize='12px' padding='2px' />
</TOOLTIP>
</HIGHCHART>

Details:

In the detail of the SERIES, you can specify more attributes than the other types of graphic:

  • isIntSumAlias: defines the column label of the dataset for define if the value must be an intermediate sum. Possible value for this column are true or false.
  • isSumAlias: defines the column label of the dataset for define if the value must be a total sum. Possible value for this column are true or false.
  • colorAlias: defines the column label of the dataset for define specific color for the value. It can be usefull for point out some informations.

For the COLORS, instead, you can specify:

  • upColor: a color for positive values
  • downColor: a color for negative values
  • sumColor: a color for sum values

************************************************************************************************

联系我:

博客:http://www.cnblogs.com/mybi

邮箱:vba-master@outlook.com

QQ:2118917071

微信:Excel_Cortana

Q群:275725345

 
Hi,I'm Cortana,Can I help you? wechat:Excel_Cortana;QQ群: 303625469
 

教程:SpagoBI开源商业智能之XML Template 图表模板的更多相关文章

  1. 《开源网店系统iWebShop2.0模板开发教程》的说明

    <开源网店系统iWebShop2.0模板开发教程>是网上广为流传的一个文档,有点问题. 其中的第4章: ========================================== ...

  2. hadoop/etc/hadoop 下没有mapred-site.xml,只有mapred.xml.template

    默认情况下,/usr/local/hadoop/etc/hadoop/文件夹下有mapred.xml.template文件,我们要复制该文件,并命名为mapred.xml,该文件用于指定MapRedu ...

  3. struts2官方 中文教程 系列十一:使用XML进行表单验证

    在本教程中,我们将讨论如何使用Struts 2的XML验证方法来验证表单字段中用户的输入.在前面的教程中,我们讨论了在Action类中使用validate方法验证用户的输入.使用单独的XML验证文件让 ...

  4. Atitit.eclipse comment  template注释模板

    Atitit.eclipse comment  template注释模板 1. Code templet1 1.1. Settpath1 1.2. 设置存储1 1.3. 导出设置1 2. Java d ...

  5. art template前端模板引擎

    偶然看到后台有一段代码 采用的是art template的模板引擎 地址为 http://aui.github.io/artTemplate/ 这段代码很简洁 var html = template( ...

  6. Template Method 模板设计模式

    什么是模板设计模式 对于不了解的模板设计模式的来说,可以认为如同古代的造纸术一样,纸所以成型,取决于用了模板的形状,形状又由镂空的木板组成,而你想要造什么纸,又取决于你使用什么材料. 上面提到了两个关 ...

  7. JBOSS 中oracle-ds.xml的配置模板

    http://blog.csdn.net/bo_hai/article/details/6076979 JBOSS 中oracle-ds.xml的配置模板.   代码模版: <?xml vers ...

  8. vue-learning:12-1- HTML5的<template>内容模板元素

    HTML5的<template>内容模板元素 HTML内容模板<template>元素将它其中的内容存储在页面文档中,以供后续使用,该内容的DOM结构在加载页面时会被解析器处理 ...

  9. Vue2.0 【第二季】第5节 Template制作模板

    目录 Vue2.0 [第二季]第5节 Template制作模板 第5节 Template制作模板 一.直接写在选项里的模板 二.写在template标签里的模板 三.写在script标签里的模板 Vu ...

随机推荐

  1. flask之wtform与flask-session组件

    1.wtform from flask import Flask, render_template, request, redirect from wtforms import Form from w ...

  2. cocosCreator 新版本的动作函数API的应用

    利用触摸位置判断,点击的是屏幕的左侧还是右侧,控制主角左右移动: 见代码: InputControl:function () { var self=this; //cc.systemEvent sel ...

  3. linux <<eof

    在平时的运维工作中,我们经常会碰到这样一个场景:执行脚本的时候,需要往一个文件里自动输入N行内容.如果是少数的几行内容,还可以用echo追加方式,但如果是很多行,那么单纯用echo追加的方式就显得愚蠢 ...

  4. dockerfile安装php遇到的坑

    fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz fetch http://dl-cdn.alpi ...

  5. Linux下tomcat修改成的80端口无法访问

    转自: https://blog.csdn.net/u013252047/article/details/72834415 tomcat放到服务器上访问8080端口还需要输入端口号,造成访问不便,好多 ...

  6. Java全栈程序员之03:Ubuntu下安装idea

    JetBrains的产品我曾经用过很长一段时间,它们是resharper和dotcover.VS号称宇宙最强IDE,直到它遇到了resharper,我们才知道,原来vs可以更好.DotCover是一个 ...

  7. Go语言之高级篇beego框架之config、httplib、context

    一.httplib 1.配置文件解析 这是一个用来解析文件的库,它的设计思路来自于 database/sql,目前支持解析的文件格式有 ini.json.xml.yaml,可以通过如下方式进行安装: ...

  8. receiving error: 'Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN' while using npm

    From:https://stackoverflow.com/questions/9626990/receiving-error-error-ssl-error-self-signed-cert-in ...

  9. C#中使用log4net框架做日志输出

    一.用法 1.引入包:https://www.nuget.org/packages/log4net/ 2.Main函数 using System; using System.IO; using log ...

  10. expdp ORA-39070:Unable to open the log file

    Oracle中,当执行expdp或impdp的时候,有时候会出现错误: [oracle@bi-dw ~]$ expdp dp_user/dp_password@dw directory=expdp_d ...