Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hel-developer-guide
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Spencer Chang
hel-developer-guide
Commits
183728bb
Commit
183728bb
authored
Aug 14, 2017
by
yang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://hel.hand-china.com/hel-guide/hel-developer-guide
parents
4ba68aaa
0c8bd767
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
119 additions
and
0 deletions
+119
-0
HlsBarChart.md
前端组件/HlsBarChart.md
+119
-0
No files found.
前端组件/HlsBarChart.md
0 → 100644
View file @
183728bb
## HlsBarChart
```
xml
<h:hlsChart
chartType=
"BAR"
style=
"margin-top:5px;margin-left:6px;"
barSourceData=
"barSourceData"
titleBgColor=
"red"
title=
"商业伙伴"
modify=
"modifyFunc"
add=
"addFunc"
color=
"#ed4e2a"
></h:hlsChart>
```
**常用的属性**
| 属性名 | 类型 | 作用 | 是否必输|
|:---: | :---: | :---: | :---: |
| id | string | 唯一标识 |
| chartType | string | 组件类型 | Y
| style | string | 组件box样式 |
| barSourceData | object | 组件数据源 | Y
| titleBgColor | string | 组件标题背景颜色 |
| title | string | 组件标题 |
| modify | function | 编辑icon触发的事件 |
| add | function | 新增icon触发的事件 |
|color|string |字体颜色|
**下面是一个例子**
```javascript
var datas = function (url) {
var odatas = [],
$.ajax({
type: 'GET',
url: "${base.contextPath}/hls/bp/master/home/secord/query",
async: false,
contentType: "application/json; charset=utf-8",
success: function (datas) {
odatas = datas.rows;
}
});
return odatas;
}();
var statisticalData = function () {
var o = {};
$.ajax({
type: 'GET',
url: "${base.contextPath}/hls/bp/master/count/query",
async: false,
contentType: "application/json; charset=utf-8",
success: function (datas) {
o.allCount = datas.rows[0].allCount;
o.monthAddCount = datas.rows[0].monthAddCount;
}
});
return o;
}();
//数据源
var barSourceData = {
barModel: {
xkey: 'description',
ykeys: 'count',
data: datas,
labels: '数值', //鼠标经过柱子图显示的描述
barColors: 'green',
barSizeRatio: 0.5,
},
statisticalModel: {
statisticalTitle: {
allCount: "总数",
monthAddCount: "本月新增"
},
statisticalData: statisticalData
}
};
function modifyFunc(e) {
alert("modifyFunc");
}
function addFunc(e) {
alert("addFunc");
}
```
#### 注意: 数据源中的属性名,需要固定,这样做是考虑到将不同的查询结果整合成统一的数据格式,方便组件渲染。
> - barModel:柱形图
| 属性名 | 类型 | 作用 |
|:---: | :---: | :---: | :---: |
| xkey | string | x轴标题对应的属性名
| ykeys | string | y轴数据对应的属性名 |
| data | Array | 数据集 |
| labels | string | 鼠标经过柱状图时ykeys对应的值的描述 |
| barColors | string | 柱子颜色 |
| barSizeRatio | Number | 柱子和数据的比例 |
> - statisticalModel:上方的统计框
| 属性名 | 类型 | 作用 |
|:---: | :---: | :---: |
| statisticalTitle | object | 统计框的属性名以及属性描述 |
| statisticalData | object | 数据源 (注意statisticalData的属性名和statisticalTitle中的属性名要对应上)
```xml
<h:hlsChart chartType="BAR" style="margin-top:5px;margin-left:6px;" barSourceData="barSourceData" titleBgColor="red"
title="商业伙伴" modify="modifyFunc" add="addFunc" color="#ed4e2a"></h:hlsChart>
```
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment