PDA

View Full Version : Total in Title of Bar Chart



ndadosky
9 Nov 2009, 8:30 AM
I have a bar chart that is loading data from a jsonStore without any problems.

I would like to add the total of the store, or a specifc value from the store to the title. This is where I am having problem.

My store has counts of vehicles in a current location and an ID number for my reference.

Here is a sample of my store for reference:

{"graph":[
{"vdloc":"Inventory","n":"0","id":"16"},
{"vdloc":"New Arrival","n":"3","id":"1"},
{"vdloc":"Strip","n":"0","id":"2"},
{"vdloc":"Frame Receipt","n":"14","id":"3"},
{"vdloc":"Paint","n":"0","id":"145"},
{"vdloc":"Open Units","n":"0","id":"146"},
{"vdloc":"Assembly Receipt","n":"2","id":"7"},
{"vdloc":"Main Line","n":"8","id":"9"},
{"vdloc":"Assembly CEPOS","n":"6","id":"11"},
{"vdloc":"Paint Repair","n":"0","id":"112"},
{"vdloc":"Quality Assessment","n":"0","id":"12"},
{"vdloc":"Ready to Ship","n":"3","id":"13"},
{"vdloc":"Sales Hold","n":"7","id":"18"},
{"vdloc":"Off Site","n":"6","id":"105"},
{"vdloc":"Shipped","n":4}]}

Here is the start of my chart:

new Ext.Panel({
iconCls:'chart',
frame: true,
title: 'Graphical Vehicle Distribution ',
renderTo: 'container',
width: 600,
height: 300,
layout:'fit',

I'd like to make the title "Graphical Vehicle Distribution (34)" or however many vehicles are in the store. I've tried sum('n') with no luck. Any help would be appreciated.

Animal
9 Nov 2009, 8:36 AM
What's the difficulty? Add a load listener to the Store which calls setTitle on the Panel.