当前位置: 动力学知识库 > 问答 > 编程问答 >

charts - Rally SDK 2.0: How to display multiple data columns with a TimeSeriesCalculator

问题描述:

I would like to display 2 time series of data with columns in the same "Rally.ui.chart.Chart". The config below for "Rally.data.lookback.calculator.TimeSeriesCalculator" stacks the columns on the same X column. Is there an easy way to group the data to be shown side-by-side instead for the same date (like the "accepted" and "time remaining" in the iteration burn-down chart) ?

Perhaps something like this?

 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?

},

];

},

网友答案:

Here is the code for the calculator used for the burn chart:

https://github.com/RallyApps/app-catalog/blob/master/src/apps/charts/burndown/BurnDownCalculator.js

Writing calculators for generating charts from lookback api is probably the most difficult thing to do in the app platform, so kudos for tackling it!

I'm not an expert either, but hopefully that above code is enough to point you in the right direction. Please post back if you either solve it or run into a new issue.

I was able to get it to work by adding the following to the chartConfig:

plotOptions: {
    column: {
        stacking: null
    }
}
网友答案:

I've found some more on this subject that I believe may be helpful:

The "stack" member of the series config in highcharts allows a series to be stacked by name. We can create a much more flexible system that allow us to specify how to stack the data by using this and overriding some methods in the Rally.data.lookback.calculator.TimeSeriesCalculator to allow the series data to be modified.

  1. prepareChartData returns series data, so we can override the output of that to add series data:

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;
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: