我使用的是ExtJS3,我想把这个图表放到一个带有动态商店http://dev.sencha.com/deploy/ext-3.4.0/examples/chart/pie-chart.html的面板中
我试图将这个图表包含到我的面板代码中,但它不起作用。对于包含在ExtJS3面板中的图表,有人有解决方案或示例吗
谢谢
发布于 2013-02-06 22:35:52
我使用您的示例使用动态存储来生成图表:
Ext.chart.Chart.CHART_URL = 'http://dev.sencha.com/deploy/ext-3.4.0/resources/charts.swf';
Ext.onReady(function(){
var store = new Ext.data.JsonStore({
url: "sample_data.php",
root: 'results',
fields: [
{name: 'season'},
{name: 'total'}
]
});
new Ext.Panel({
width: 400,
height: 400,
title: 'Pie Chart with Legend - Favorite Season',
renderTo: 'container',
items: {
store: store,
xtype: 'piechart',
dataField: 'total',
categoryField: 'season',
//extra styles get applied to the chart defaults
extraStyle:
{
legend:
{
display: 'bottom',
padding: 5,
font:
{
family: 'Tahoma',
size: 13
}
}
}
}
});
});其中http://dev.sencha.com/deploy/ext-3.4.0/resources/charts.swf是可以找到图表的目标,sample_data.php返回以下json:
{"results":[
{"total":"150","season":"Summer"},
{"total":"245","season":"Fall"},
{"total":"117","season":"Winter"},
{"total":"184","season":"spring"}
]}注意:这通常应该设置为本地资源。
希望这能有所帮助。
https://stackoverflow.com/questions/14193416
复制相似问题