用Filter Function作簡單線性圖Drill-Down

首先,想像有一張線性圖(Line Chart),上頭的線是由許多資料點所構成。在Flex中,一旦對該資料及和作了過濾的動作,圖表會重繪。然後,Flex3的圖表都有支援selectedItems:Array的方法,以獲取你圈選的資料點,因此,我們可以藉由選取的資料點,得到一個範圍,利用範圍來過濾原資料集合,就可以做到類似Drill-Down的功能了。

這是範例(線性圖的drill down)
這是原始碼


Drill down into data in a line chart.

With Flex3 data visualization package, we are able to get the selectedItems by

ChartBase.selectionMode = "multiple";<br/>ChartBase.selectedItems

Therefore, it is handy to measure a range for filtering out our data. We have to know that every series in a chart contains a data provider. The data providers are ListCollectionView objects. So to filter out those objects will update the display of chart immediately. Those lines will be redrawn. You could see the line scaled just like drilling-down into it.

Here is a sample and source code.
Simple Drill Down into Line Chart
Source

Tags: , ,

Leave a Reply