教程:SpagoBI开源商业智能之XML Template 图表模板
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
教程:SpagoBI开源商业智能之XML Template 图表模板的更多相关文章
- 《开源网店系统iWebShop2.0模板开发教程》的说明
<开源网店系统iWebShop2.0模板开发教程>是网上广为流传的一个文档,有点问题. 其中的第4章: ========================================== ...
- hadoop/etc/hadoop 下没有mapred-site.xml,只有mapred.xml.template
默认情况下,/usr/local/hadoop/etc/hadoop/文件夹下有mapred.xml.template文件,我们要复制该文件,并命名为mapred.xml,该文件用于指定MapRedu ...
- struts2官方 中文教程 系列十一:使用XML进行表单验证
在本教程中,我们将讨论如何使用Struts 2的XML验证方法来验证表单字段中用户的输入.在前面的教程中,我们讨论了在Action类中使用validate方法验证用户的输入.使用单独的XML验证文件让 ...
- Atitit.eclipse comment template注释模板
Atitit.eclipse comment template注释模板 1. Code templet1 1.1. Settpath1 1.2. 设置存储1 1.3. 导出设置1 2. Java d ...
- art template前端模板引擎
偶然看到后台有一段代码 采用的是art template的模板引擎 地址为 http://aui.github.io/artTemplate/ 这段代码很简洁 var html = template( ...
- Template Method 模板设计模式
什么是模板设计模式 对于不了解的模板设计模式的来说,可以认为如同古代的造纸术一样,纸所以成型,取决于用了模板的形状,形状又由镂空的木板组成,而你想要造什么纸,又取决于你使用什么材料. 上面提到了两个关 ...
- JBOSS 中oracle-ds.xml的配置模板
http://blog.csdn.net/bo_hai/article/details/6076979 JBOSS 中oracle-ds.xml的配置模板. 代码模版: <?xml vers ...
- vue-learning:12-1- HTML5的<template>内容模板元素
HTML5的<template>内容模板元素 HTML内容模板<template>元素将它其中的内容存储在页面文档中,以供后续使用,该内容的DOM结构在加载页面时会被解析器处理 ...
- Vue2.0 【第二季】第5节 Template制作模板
目录 Vue2.0 [第二季]第5节 Template制作模板 第5节 Template制作模板 一.直接写在选项里的模板 二.写在template标签里的模板 三.写在script标签里的模板 Vu ...
随机推荐
- 码云 使用 汉化 GitHub
enhancement 增强feature 功能duplicate 重复的invalid 无效的wontfix 无法修改 不处理 ===== Wiki 主要是您项目的文档(说明, 状态)等等. 该项目 ...
- 4923: [Lydsy1706月赛]K小值查询 平衡树 非旋转Treap
国际惯例的题面:这种维护排序序列,严格大于的进行操作的题都很套路......我们按照[0,k],(k,2k],(2k,inf)分类讨论一下就好.显然第一个区间的不会变化,第二个区间的会被平移进第一个区 ...
- BZOJ.2002.Bounce 弹飞绵羊(LCT)
题目链接 从一个点只能往后跳,即后继状态只有一个,那么拿nxt[x]做fa[x]啊!这样就成了一棵树,从每个点开始的答案是它到所在树的根节点的距离. nxt[]的更改即动态修改树边,用LCT即可. 这 ...
- 自定义reg52.h头文件(单片机学习重难点核心知识点)
/*-------------------------------------------------------------------------- 自定义REG52头文件 @auth lei @ ...
- [HAOI2016]食物链
OJ题号:BZOJ4562.洛谷3183 思路:记忆化搜索. 本体可以转化成“求有向图中入度为0的结点到出度为0的结点的路径数”. 每次加边时记录每个结点的入度和出度,然后从入度为0的结点开始搜索,搜 ...
- 广州移动宽带DNS
目前还搞不明白这些DNS服务器是怎么得出来的,现在只停留在网上收集. 下面是收集比较靠谱的DNS广州移动宽带的: ns3.gd.cnmobile.net 221.179.38.7 ns4.gd.cnm ...
- java判断传进来的是否是图片
public static void main(String[] args) throws IOException { String filePath = "C:\\Users\\80975 ...
- BTrace使用小结
简介 BTrace是一个安全的JVM动态追踪工具,最初为原Sun公司Kenai项目下面的一个子项目. 典型的使用场景是,“我要查个问题,可那个方法没有打印入口参数和返回结果日志”,“我想看某个方法的执 ...
- [leetcode]Unique Paths @ Python
原题地址:https://oj.leetcode.com/problems/unique-paths/ 题意: A robot is located at the top-left corner of ...
- Cena评测系统在win10中测评cpp程序
1.装了cena-0.8.1-20110710-setup.exe 2.打补丁:cena-0.8.2-patch.zip 3.菜单->工具->选项->编程语言 修改G++ (mi ...