2011-06-20 11 views
0

私のプロットの特定の領域に各シリーズポイントのカウントを取得しようとしています。 プロットはグリッド(ボックス)で構成されており、これらのボックスのそれぞれに存在するシリーズポイントの数を知りたいと考えています。私は(グリッド1はシリーズ1の2つ、シリーズ2は0、シリーズ3は3つ、シリーズ5は4つのように) 何か助けていただければ幸いです。JFreechart:各シリーズを一定間隔でカウントする

+0

シングル[アカウント](http://stackoverflow.com/users/798705/jpo)からの質問を投稿してください。 – trashgod

答えて

0

あなたは、各項目の境界を取得することができますXYItemsを持っている:

final Collection<ChartEntity> entities = 
    chartpanel.getChartRenderingInfo().getEntityCollection().getEntities(); 
for (final ChartEntity e : entities) { 
    if (e instanceof XYItemEntity) { 
    final XYItemEntity xyItem = (XYItemEntity) e; 
    final int index = xyItem.getItem(); 
    final int series = xyItem.getSeriesIndex(); 
    Rectangle2D r = e.getArea().getBounds2D(); 
    checkPosition(r); // here you can check if the coordinates are inside your "box" 
    } 
} 
関連する問題