需要帮助才能从主图表中打开子图表? [英] Need help to open a subchart from a main chart?
问题描述
我有以下图表:
现在我的问题是,当用户点击图表的Linux部分时,我想打开一个包含Linux OS信息的新图表,如红色所示。我试过这个:
Now my problem is I want to open a new chart containing the information for Linux OS when a user clicks on Linux portion of chart, shown in red. I have tried this:
//check if Linux OS is clicked on chart...
if("Linux".equals(chartMouseEvent.getEntity().getToolTipText()))
{
//open new chart having the information for Linux
}
但我认为可能有更好的替代品来做同样的工作。
如果您知道如何实现这一点,请提供帮助。
But I think there may be some better alternate to do the same job. So please help if you know how to achieve this.
推荐答案
ChartEntity
很好选择,但 getToolTipText()
不是唯一可用的资源。 getURLText()
方法也很方便,使用 StandardPieURLGenerator
。或者, PieURLGenerator
可以直接访问数据集:
ChartEntity
is a good choice, but getToolTipText()
is not the only resource available. The getURLText()
method is also handy, using the information provided by the StandardPieURLGenerator
. Alternatively, a custom implementation of PieURLGenerator
can access the data set directly:
plot.setURLGenerator(new PieURLGenerator() {
public String generateURL(PieDataset dataset, Comparable key, int pieIndex) {
// access the dataset as required
}
});
这篇关于需要帮助才能从主图表中打开子图表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!