我想显示2个时间序列的数据,其中的列在同一个" Rally.ui.chart.Chart"中。 " Rally.data.lookback.calculator.TimeSeriesCalculator"下面的配置将列堆叠在同一X列上。是否有一种简单的方法可以将数据分组并排显示在同一日期(例如"已接受"和#34;剩余时间"在迭代烧毁图表中)?
也许是这样的?
getMetrics: function () {
return [
{
"field": "TaskRemainingTotal",
"as": "Hours Remaining",
"f": "sum",
"display": "column"
},
{
"field": "PlanEstimate",
"as": "Story Points Accepted",
"f": "filteredSum",
"filterField": "ScheduleState",
"filterValues": ["Accepted", "Verified"],
"display": "column",
"group": "1" //????? is there a specifier to separate this data?
},
];
},
答案 0 :(得分:1)
以下是用于刻录图表的计算器的代码:
https://github.com/RallyApps/app-catalog/blob/master/src/apps/charts/burndown/BurnDownCalculator.js
编写用于从lookback api生成图表的计算器可能是应用程序平台中最难处理的事情,所以要求解决它!
我也不是专家,但希望上面的代码足以指出你正确的方向。如果您要么解决它或遇到新问题,请回复。
我可以通过在chartConfig中添加以下内容来实现它:
plotOptions: {
column: {
stacking: null
}
}
答案 1 :(得分:0)
我发现有关此主题的更多内容我认为可能会有所帮助:
高图中系列配置的“堆栈”成员允许按名称堆叠系列。我们可以创建一个更灵活的系统,允许我们使用它来指定如何堆叠数据,并覆盖Rally.data.lookback.calculator.TimeSeriesCalculator中的一些方法,以允许修改系列数据。
prepareChartData: function(store) {
var snapshots = [];
store.each(function(record) {
snapshots.push(record.raw);
});
var a = this.runCalculation(snapshots);
for (var k in a.series) {
if (a.series[k].name.startsWith("Story")) a.series[k].stack = "Story";
}
return a;
}
_buildSeriesConfig: function(calculatorConfig) {
var aggregationConfig = [],
metrics = calculatorConfig.metrics,
derivedFieldsAfterSummary = calculatorConfig.deriveFieldsAfterSummary;
for (var i = 0, ilength = metrics.length; i < ilength; i += 1) {
var metric = metrics[i];
var seriesConfig = {
name: metric.as || metric.field,
type: metric.display,
dashStyle: metric.dashStyle || "Solid"
};
for (var k in metric.seriesConfig) {
seriesConfig[k] = metric.seriesConfig[k];
}
aggregationConfig.push(seriesConfig);
}
for (var j = 0, jlength = derivedFieldsAfterSummary.length; j < jlength; j += 1) {
var derivedField = derivedFieldsAfterSummary[j];
var seriesConfig = {
name: derivedField.as,
type: derivedField.display,
dashStyle: derivedField.dashStyle || "Solid"
};
for (var k in derivedField.seriesConfig) {
seriesConfig[k] = derivedField.seriesConfig[k];
}
aggregationConfig.push(seriesConfig);
}
return aggregationConfig;
},
这个方法允许我们在getMetrics中提供一个seriesConfig属性,如:
getMetrics: function() {
return [{
"field": "TaskRemainingTotal", // the field in the data to operate on
"as": "Hours Remaining", // the label to appear on the chart
"f": "sum", // summing function to use.
"display": "column", // how to display the point on the chart.
seriesConfig: {
"stack": "Hours",
"color": "#005eb8"
}
}, {
"field": "PlanEstimate", // the field in the data to operate on
"as": "Story Points Accepted", // the label to appear on the chart
"f": "filteredSum",
"filterField": "ScheduleState", // Only use points in seduled sate accepted or Verified
"filterValues": ["Accepted", "Verified"],
"display": "column",
seriesConfig: {
"stack": "Points",
"color": "#8dc63f"
}
}, {
"field": "PlanEstimate", // the field in the data to operate on
"as": "Story Points Remaining", // the label to appear on the chart
"f": "filteredSum",
"filterField": "ScheduleState", // Only use points in seduled sate accepted or Verified
"filterValues": ["Idea", "Defined", "In Progress", "Completed"],
"display": "column",
seriesConfig: {
"stack": "Points",
"color": "#c0c0c0"
}
},
];
},
使用选项#2,我们可以在配置指标的同一上下文中控制和添加任何系列配置数据,而无需担心配置订单。选项#2有点危险,因为下划线暗示该方法是私有的,因此没有合同保证在未来的修订中保持兼容。 (也许集会的人会看到这个并为我们扩展功能)