Hi all,
I would like to display a pie chart, the xField and labelField values are in an array in my store, how can my Serie access this values? I need this store because it contains a value used as title of the view.
Here is the model of the store :
Code:
Ext.define('mBankingApp.model.AssetView', {
extend: 'Ext.data.Model',
config: {
idProperty: 'subscriptionId',
fields : [
{name: 'subscriptionId', type: Ext.data.Types.INTEGER},
{name: 'portfolioId', type: Ext.data.Types.STRING},
{name: 'totalAssetValue', type: Ext.data.Types.STRING},
{name: 'assetList' } // Array of Assets
]
}
});
Here is the model of the array in the store :
Code:
Ext.define('mBankingApp.model.Asset', {
extend: 'Ext.data.Model',
config: {
idProperty: 'assetId',
fields : [
{name: 'assetId', type: Ext.data.Types.INTEGER},
{name: 'assetCategoryCode', type: Ext.data.Types.STRING},
{name: 'assetCategoryLabel',type: Ext.data.Types.STRING},
{name: 'assetValue', type: Ext.data.Types.FLOAT}
]
}
});
And here is my chart view :
Code:
Ext.define("mBankingApp.view.AssetViewChart", {
extend: 'Ext.Panel',
requires: ['Ext.chart.PolarChart', 'Ext.chart.series.Pie', 'Ext.chart.interactions.Rotate'],
xtype: 'assetViewChart',
config: {
layout: 'fit',
title: Ext.getStore('assetViewStore').getData().items[0].data.totalAssetValue,
items: [
{
layout: 'fit',
xtype: 'polar',
store: 'assetViewStore',
animate: true,
colors: ["#115fa6", "#94ae0a", "#a61120", "#ff8809", "#ffd13e"],
interactions: ['rotate', 'itemhighlight'],
legend: {
docked: 'right',
verticalwidth: 100
},
innerPadding: 45,
series: [
{
type: 'pie',
xField: 'assetList.assetValue',
labelField: 'assetList.assetCategoryCode',
highlightCfg: {
margin: 20
},
}]
}]
},
});
Thanks,
Barry