2011-06-09 67 views
2

我有以下圖表:需要幫助從主圖表打開子圖表?

chart

現在我的問題是,我想,當用戶點擊圖表的Linux的部分,用紅色表示打開包含了Linux操作系統的信息,新的圖表。我試過這個:

//check if Linux OS is clicked on chart... 
if("Linux".equals(chartMouseEvent.getEntity().getToolTipText())) 
{ 
    //open new chart having the information for Linux 
} 

但我認爲可能有一些更好的替代做同樣的工作。 所以,如果你知道如何實現這一點,請幫助。

回答

2

ChartEntity是一個不錯的選擇,但​​不是唯一可用的資源。使用StandardPieURLGenerator提供的信息,getURLText()方法也很方便。或者,PieURLGenerator的自定義實現可以直接訪問數據集:

plot.setURLGenerator(new PieURLGenerator() { 
    public String generateURL(PieDataset dataset, Comparable key, int pieIndex) { 
     // access the dataset as required 
    } 
}); 
+0

ya感謝您的回覆。 – Ved 2011-06-10 06:31:47