开发者

same data provider for chart and data grid

开发者 https://www.devze.com 2023-03-29 12:19 出处:网络
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.

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.....

0

精彩评论

暂无评论...
验证码 换一张
取 消