类型为pie的RallyChart

类型为pie的RallyChart,rally,Rally,我正在尝试使用设置为pie的类型说明符连接RallyChart和Rally.data.custom.Store。当RallyChart的类型设置为column或为空时,数据显示正确。当类型设置为pie时,我会得到一个包含所有0%s的pie 以下是我的店铺的外观: var myStore = Ext.create('Rally.data.custom.Store', { data: mySeries, fields: [ { name: 'WorkItems', t

我正在尝试使用设置为pie的类型说明符连接RallyChart和Rally.data.custom.Store。当RallyChart的类型设置为column或为空时,数据显示正确。当类型设置为pie时,我会得到一个包含所有0%s的pie

以下是我的店铺的外观:

var myStore = Ext.create('Rally.data.custom.Store', {
    data: mySeries,
    fields: [
        { name: 'WorkItems', type: 'string' },
        { name: 'Count', type: 'int' }
    ]
});
_buildChart: function(myStore) {
this.myChart = Ext.create('Rally.ui.chart.Chart', {
    height: 400, 
    store: myStore,
    series: [{
        type: 'pie',
        name: 'Count',
        dataIndex: 'Count'
    }],
    xField: 'WorkItems',
    chartConfig: {
        chart: {
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false,
                type: 'pie'
        },
        title: {
        text: 'Work Breakdown in Selected Sprint'
        },
        tooltip: {
                pointFormat: '{series.name}: <b>{point.percentage}%</b>',
                percentageDecimals: 1
        },
        plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
                        enabled: true,
                        color: '#000000',
                        connectorColor: '#000000',
                        formatter: function() {
                            return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';
                        }
                    }
                }
            }
    }
});
this.add(this.myChart);
}
下面是我的图表配置函数的外观:

var myStore = Ext.create('Rally.data.custom.Store', {
    data: mySeries,
    fields: [
        { name: 'WorkItems', type: 'string' },
        { name: 'Count', type: 'int' }
    ]
});
_buildChart: function(myStore) {
this.myChart = Ext.create('Rally.ui.chart.Chart', {
    height: 400, 
    store: myStore,
    series: [{
        type: 'pie',
        name: 'Count',
        dataIndex: 'Count'
    }],
    xField: 'WorkItems',
    chartConfig: {
        chart: {
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false,
                type: 'pie'
        },
        title: {
        text: 'Work Breakdown in Selected Sprint'
        },
        tooltip: {
                pointFormat: '{series.name}: <b>{point.percentage}%</b>',
                percentageDecimals: 1
        },
        plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
                        enabled: true,
                        color: '#000000',
                        connectorColor: '#000000',
                        formatter: function() {
                            return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';
                        }
                    }
                }
            }
    }
});
this.add(this.myChart);
}
\u构建图表:函数(myStore){
this.myChart=Ext.create('Rally.ui.chart.chart'{
身高:400,
商店:myStore,
系列:[{
键入“pie”,
姓名:'计数',
数据索引:“计数”
}],
xField:“工作项”,
图表配置:{
图表:{
plotBackgroundColor:null,
plotBorderWidth:null,
影子:错,
键入:“馅饼”
},
标题:{
文本:“选定Sprint中的工作分解”
},
工具提示:{
pointFormat:“{series.name}:{point.percentage}%”,
百分比小数:1
},
打印选项:{
馅饼:{
allowPointSelect:true,
光标:“指针”,
数据标签:{
启用:对,
颜色:'#000000',
连接器颜色:'#000000',
格式化程序:函数(){
返回“+this.point.name+”:“+this.percentage+”%”;
}
}
}
}
}
});
this.add(this.myChart);
}
我传入的数据如下所示: [‘缺陷’,4], ['Feature A',4] [‘功能B’,4]


你知道为什么柱状图可以显示它,而饼图不能吗?

我打赌这是2.0p5版图表中的一个错误。我们刚刚发布了SDK的2.0rc1版,其中包括一个更好的图表版本。以下代码示例显示了如何在2.0rc1中使用数据创建饼图:

//from inside your app
this.add({
    xtype: 'rallychart',
    height: 400,
    chartData: {
        series: [{
            type: 'pie',
            name: 'Browser share',
            data: [
               ['Defects', 4], ['Feature A', 4], ['Feature B', 4]
            ]
        }]
    },
    chartConfig: {
        chart: {
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false,
            type: 'pie'
        },
        xAxis: {},//must specify empty x-axis due to bug
        title: {
            text: 'Work Breakdown in Selected Sprint'
        },
        tooltip: {
            pointFormat: '{series.name}: <b>{point.percentage}%</b>',
            percentageDecimals: 1
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    formatter: function() {
                        return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';
                    }
                }
            }
        }
    }
});
//从应用程序内部
这个。添加({
xtype:“rallychart”,
身高:400,
图表数据:{
系列:[{
键入“pie”,
名称:“浏览器共享”,
数据:[
[“缺陷”,4],“特征A”,4],“特征B”,4]
]
}]
},
图表配置:{
图表:{
plotBackgroundColor:null,
plotBorderWidth:null,
影子:错,
键入:“馅饼”
},
xAxis:{},//由于错误,必须指定空的x轴
标题:{
文本:“选定Sprint中的工作分解”
},
工具提示:{
pointFormat:“{series.name}:{point.percentage}%”,
百分比小数:1
},
打印选项:{
馅饼:{
allowPointSelect:true,
光标:“指针”,
数据标签:{
启用:对,
颜色:'#000000',
连接器颜色:'#000000',
格式化程序:函数(){
返回“+this.point.name+”:“+this.percentage+”%”;
}
}
}
}
}
});

注意:不再需要创建中间存储来传递到图表-您只需将您的系列作为chartData配置的一部分传递即可。

您使用的是2.0p5还是最近发布的2.0rc1?我问这个问题是因为两个版本在Rally.ui.chart.chart上有一些显著的差异。哦,我忘了添加它了。我用的是2.0p5,这很有道理!谢谢你的例子,我马上就试试。谢谢你的回答!对于试图复制此内容的人,唯一要添加的注释是数据字段中缺少逗号。['Defects',4],'Feature A',4]['Feature B',4]应该是['Defects',4],'Feature A',4],'Feature B',4]