I've been searching for an answer for this but since i couldn't find any, i'll post the question.
I have a plot drawn, with a list below showing some data, one of the parameters of each row is drawn in the plot.
I'm trying to change the color of the point when the user clicks in one of the views of the list, to reflect in the plot that the row matches the point, but i haven't been able to replicate it.
There is any way to get an specific point of the graph, to change its color?
Thanks in advance.
I don't know if what you are trying to do is possible but you can try to add a serie to your plot containing the point that you want to highlight when user clicks. When a new click is done you just need to remove the added serie and add a new one containing the new point.
The added serie must have a different style so you can see the "changed color" and must be the last added serie so it will be in forground.
Hope it helps
What you can do to adapt it to your use case is to extend a XYPlot
class, create a SeriesType highlightedPoint
property and add a method like (not tested) :
public void highlightPoint(Number x, Number y, FormatterType formatter){
// if there is already a highlighted point we remove it (we want to highlight just one point)
if(highlightedPoint != null) {
removeSeries(highlightedPoint);
highlightedPoint = null;
}
// we need to highlight the new point, which means adding a serie on top of the others
highlightedPoint = new SimpleXYSeries("Highlighted Point");
highlightedPoint.addFirst(x,y);
addSeries(highlightedPoint, formatter);
}
You just need to call this method on your plot instance each time user clicks on your list.