带点的拉力累积流程图

时间:2013-02-26 21:24:16

标签: rally

我希望尝试使用他们的新API / SDK按照集合中的故事点进行累积流程图,并在他们的GitHub页面上找到一些示例代码RallyAnalytics GitHub

因此,经过一些工作,我有一定程度的工作,但不明白或找不到任何文档,如何配置更多。看起来生成的报告正在计算,而不是我尝试在fieldsToSum中添加的PlanEstimate。我怎样才能通过c_KanbanState对PlanEstimate字段求和,而不只是给我一个与该周的c_KanbanState相匹配的故事?下面的示例代码减去GitHub的缩小代码。

     var userConfig = {
            title: 'Cumulative Flow Diagram',
            debug: false,
            trace: false,
            // asOf: "2012-11-01",  // Optional. Only supply if want a specific time frame. Do not send in new Date().toISOString().
            granularity: 'week',
            fieldsToSum: ['PlanEstimate'],
            scopeField: "Project",  // Supports Iteration, Release, Tags, Project, _ProjectHierarchy, _ItemHierarchy
            scopeValue: 'scope',
            scopeData: {
              StartDate: new Date("2012-12-01T07:00:00.000Z"),
              EndDate: new Date(new Date()),
              Name: ""
            },
            //fieldNames: ['count', 'PlanEstimate']

            kanbanStateField: 'c_KanbanState',
            chartSeries: [
              {name: 'To Do'},
              {name: 'Dev Ready'},
              {name: 'In Dev'},
              {name: 'Peer Review'},
              {name: 'QA Ready'},
              {name: 'QA Done'},
              {name: 'Accepted'}
            ]
        }
         (function() {

            var charts = {};
            var visualizer;
            var nameToDisplayNameMap;

            createVisualization = function(visualizationData) {

              if (typeof visualizationData !== "undefined" && visualizationData !== null) {
                categories = visualizationData.categories;
                series = visualizationData.series;
                charts.lowestValueInLastState = visualizationData.lowestValueInLastState;

                charts.chart = new Highcharts.Chart({
                  chart: {
                     renderTo: 'chart-container',
                     defaultSeriesType: 'column',
                     zoomType: 'x'
                  },
                  legend: {
                     enabled: true
                  },
                  credits: {
                     enabled: false
                  },
                  title: {
                     text: userConfig.title
                  },
                  subtitle: {
                     text: userConfig.scopeData.Name
                  },
                  xAxis: {
                     categories: categories,
                     tickmarkPlacement: 'on',
                     tickInterval: Math.floor(categories.length / 12) + 1,
                     title: {
                         text: userConfig.granularity.slice(0, 1).toUpperCase() + userConfig.granularity.slice(1) + 's'
                     }
                  },
                  yAxis: [
                     {
                         title: {
                             text: 'Total Points',
                         },
                         min: charts.lowestValueInLastState
                     }                    
                  ],
                  tooltip: {
                     formatter: function() {
                         point = this.point
                         s = point.series.name + ': <b>' + point.y + '</b><br \>';
                         if (point.x == point.series.data.length - 1) {
                             s += point.category.slice(0, point.category.length - 1) + ' to-date';
                         } else {
                             s += point.category;
                         }
                         return s;
                     }
                  },
                  plotOptions: {
                      series: {
                          events: {
                              legendItemClick: function(event) {
                                  if (this.chart.series.length == this.index + 1) {
                                      if (!this.visible) {
                                         this.chart.yAxis[0].setExtremes(charts.lowestValueInLastState);
                                      } else {
                                         this.chart.yAxis[0].setExtremes(0);
                                      };
                                  };
                                  return true;
                              }
                          }                          
                      }
                  },    

                  series: series
                });  // end of chart

              } else {
                // Put a spinner in the chart containers until first fetch returns
                $('#chart-container')
                  .html('<img height="20px" src="https://rally1.rallydev.com/slm/js-lib/ext/2.2/resources/images/default/grid/loading.gif"></img>')
                  .attr("style", "text-align:center");

              };   

            };   


            $(document).ready(function() {
              visualizer = new CFDVisualizer(charts, userConfig, createVisualization);
            });

        })();

1 个答案:

答案 0 :(得分:0)

您可能使用稍微较旧的版本,因为最新的版本在配置中没有fieldsToSum参数,但您可以通过在CFDVisualizer.coffee中将几行添加到此处来升级图表以对PlanEstimate求和:

@config.lumenizeCalculatorConfig.metrics = [
  {f: 'groupBySum', field: 'PlanEstimate', groupByField: @config.kanbanStateField, allowedValues: allowedValues}
]

从:

@config.lumenizeCalculatorConfig.metrics = [
  {f: 'groupByCount', groupByField: @config.kanbanStateField, allowedValues: allowedValues}
]

您可能还应该更改cfd.html中的轴标签。

如果这太难实现(CoffeeScript可能不熟悉),请告诉我,我会将新版本发布到GitHub。