[JViews] comment highlighter un autre point que celui sélectionné par l'utilisateur ?
Bonjour à tous !
J'ai une petite galère avec JViews.
j'ai un graph avec 2 nuages de points (2 IlvDataSet)
mais chaque point d'un nuage est lié à un autre point de l'autre dataset.
J'arrive très bien à agir sur le IlvDisplayPoint que l'utilisateur pointe pour en changer la couleur, mais je voudrais aussi pouvoir changer en même temps la couleur de l'autre point...
Mon problème est que je n'arrive pas à récupérer l'autre IlvDisplay depuis le IlvChartHighlightInteractor
pour vous donner une idée :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| IlvChartInteractor highlight = new IlvChartHighlightInteractor() {
protected IlvDisplayPoint pickData(IlvChartDataPicker picker) {
IlvDisplayPoint dp = super.pickData (picker);
if(dp != null) {
IlvDataRenderingHint hint = new IlvDefaultDataRenderingHint(new IlvStyle(Color.GREEN));
dp.getRenderer().setRenderingHint(dp.getDataSet(), dp.getIndex(), hint);
String asset = dp.getDataSet().getDataLabel(dp.getIndex());
int otherPointIdx = 0;
if(this.getChart().getDataSource().getDataSetCount()>1) { // si il y a 2 nuages de points
// cherche l'indice du point jumeau dans l'autre dataset
for(int i = 0 ; i < this.getChart().getDataSource().getDataSet(1).getDataCount() ; ++i) {
String otherAsset = this.getChart().getDataSource().getDataSet(1).getDataLabel(i);
if(asset.contains(otherAsset))
otherPointIdx = i;
}
// NE MARCHE PAS
IlvDisplayPoint otherPoint = this.getChart().getDisplayItems(picker).get(otherPointIdx);
otherPoint.getRenderer().setRenderingHint(otherPoint.getDataSet(), otherPointIdx, hint);
setHighlightedPoint(otherPoint);
}
System.out.println(dp);
return dp;
} else {
return null;
}
}
};
_chart.addInteractor(highlight); |
Est-ce que vous avez une idée ?
Merci !!!