查看Api 2.0p5和图表。
我正在寻找吞吐量图表的变体,基本上有......
所以我到目前为止所有这些都在我的拉力赛应用程序中工作,除了我的所有数字目前都是硬编码的。如何将这些信息正确地输入我的图表?
我看到了一个使用商店的例子,但是看起来古怪而诚实,我不知道在哪里看到它试图复制。
代码在下面,如果有人有想法或想法我会很感激:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="240" />
<title>Throughput Chart</title>
<script type="text/javascript" src="https://rally1.rallydev.com/apps/2.0p5/sdk.js?debug=true"></script>
<script type="text/javascript">
Rally.onReady(function () {
Ext.create('Ext.Container', {
items: [
{
xtype: 'rallychart',
height: 400,
series: [{
name: 'Defect Count',
data: [2, 2, 3, 2, 1, 4, 2, 3, 5, 3, 5, 4]
}, {
name: 'Story Count',
data: [3, 4, 4, 2, 5, 3, 4, 5, 6, 3, 4, 8]
}, {
name: 'Story Points',
color: '#89A54E',
type: 'spline',
yAxis: 1,
data: [55, 34, 50, 31, 44, 61, 55, 22, 50, 48, 34, 44]
}],
chartConfig: {
chart: {
type: 'column'
},
title: {
text: 'Kanban State Counts',
align: 'center'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
yAxis: [{
title: {
text: 'Count'
},
stackLabels: {
enabled: true,
style: {
fontWeight: 'bold',
}
}
},
{
opposite: true,
title: {
text: 'Story Points'
}
}],
}
}
],
renderTo: Ext.getBody().dom
});
});
</script>
<style type="text/css">
</style>
</head>
<body>
</body>
</html>
答案 0 :(得分:2)
这是在WsapiDataStore中使用用户素材数据的基本示例。代码只是按ScheduleState汇总Stories并将计数添加到Ext.data.store。然后,应用程序使用Rally.ui.chart.ChartView组件在条形图中按计划状态显示故事计数。
<!DOCTYPE html>
<html>
<head>
<title>ChartExample</title>
<script type="text/javascript" src="https://rally1.rallydev.com/apps/2.0p5/sdk.js"></script>
<script type="text/javascript">
Rally.onReady(function() {
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function() {
Ext.create('Rally.data.WsapiDataStore', {
model: 'UserStory',
autoLoad: true,
listeners: {
load: this._onDataLoaded,
scope: this
}
});
},
_onDataLoaded: function(store, data) {
var records = [];
var scheduleStateGroups = ["Defined","In-Progress","Completed","Accepted"]
// State count variables
var definedCount = 0;
var inProgressCount = 0;
var completedCount = 0;
var acceptedCount = 0;
// Loop through returned data and group/count by ScheduleState
Ext.Array.each(data, function(record) {
//Perform custom actions with the data here
//Calculations, etc.
scheduleState = record.get('ScheduleState');
switch(scheduleState)
{
case "Defined":
definedCount++;
break;
case "In-Progress":
inProgressCount++;
break;
case "Completed":
completedCount++;
break;
case "Accepted":
acceptedCount++;
}
});
//Create a store containing the chart data
var scheduleStateStore = Ext.create('Ext.data.Store', {
fields: ['KanbanState', 'ObjectID_Count'],
data: {
rows: [
{ScheduleState: 'Defined', ObjectCount: definedCount},
{ScheduleState: 'InProgress', ObjectCount: inProgressCount},
{ScheduleState: 'Completed', ObjectCount: completedCount},
{ScheduleState: 'Accepted', ObjectCount: acceptedCount}
]
},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'rows'
}
}
});
// Configure and Add the chart
this.add(
{
xtype: 'rallychart',
height: 400,
series: [
{
type: 'column',
dataIndex: 'ObjectCount',
name: 'Count',
visible: true
}
],
store: scheduleStateStore,
chartConfig: {
chart: {
},
title: {
text: 'User Story Schedule State Counts',
align: 'center'
},
xField : 'ScheduleState',
xAxis: [
{
categories: scheduleStateGroups,
title: {
text: 'ScheduleState'
}
}
],
yAxis: {
title: {
text: 'Count'
}
},
plotOptions : {
column: {
color: '#F00'
},
series : {
animation : {
duration : 2000,
easing : 'swing'
}
}
}
}
}
);
}
});
Rally.launchApp('CustomApp', {
name: 'ChartExample'
});
});
</script>
<style type="text/css">
.app {
/* Add app styles here */
}
</style>
</head>
<body></body>
</html>