same data provider for chart and data grid
I want to display the same data in a chart and a data grid. I want to use the same data provider for both of them to reduce the amount of SQL queries.
How do 开发者_开发知识库I transform the database structure into the chart structure and into the table structure using ActionScript?*
Database structure in JSON format:
[
{key:, year:, value:},
{key:, year:, value:}
]
Data provider structure required by a chart:
[
{series1:, series2:, year:},
{series1:, series2:, year:}
]
Data provider structure required by data grid:
[
{key:, year2000:, year2001:, ...},
{key:, year2000:, year2001:, ...}
]
You can create a simple Util Class that parse the data and return it a specidic componenet
for example
dataGrid.dataProvider = DataUtil.parseForDG(SQLData); chatData = DataUtil.parseForChat(SQLData);
etc.....
精彩评论