Page 1 of 1

Viewing seriesMarks on deman

Posted: Thu Aug 14, 2008 12:43 pm
by 7667185
Is there any way of viewing single SeriesMark-values only on demand? I.e. if the mouse is within a certain distance of a point, it is set visible?

Today I have a nearestpoint-line to the closest point, along with a simple annotation, but it does not look good and the nearestpoint-line flies around like a diseased dog (surely due to my "All series -> all points"-traversing algorithms but still).

So instead, I'd like to just toggle the Series.getMarks.getCertainMark.getCallout.setVisible true or something. Unfortunately it does not seem like I am able to obtain a single mark for such editing. My question is thus; can I toggle the visibility of a single point's series mark? That would be so sweet!! I have included a snippet of how I tried doing it but which didnt work


Thanks in advance!
Marius

Code: Select all

((MarksItem) (miniSeries.getMarks().getItems().get(pointIndex))).setVisible(true);

Posted: Tue Aug 19, 2008 11:56 am
by Pep
Hello Marius,

to hide specific Series Marks you should use code similar to the following :

Code: Select all

tChart2.getSeries(0).getMarks().getItems().getItem(0).setVisible(false);

Posted: Wed Aug 20, 2008 8:32 am
by 7667185
Thanks for your reply. Unfortunately, the problem is the other way around; I want to display points on demand, rather than hiding them.

My approach was to set all marks not visible when drawing series, and then as I move around in the chart I want certain points of certain series (both of which I have already calculated) to have their mark set visible by using the snippet you suggested:

(

Code: Select all

theClosestSeries.getMarks().getItems().getItem(theClosestPoint).setVisible(true); 
)
but this is not working.

When I do a

Code: Select all

System.out.println(pointIndex+" "+miniSeries.getTitle()+" "+miniSeries.getMarks().getItems().getItem(pointIndex).getVisible());
I get the correct series name and point number, and also the MarkItem says visible is true, but it is not drawn :? I repaint all the time


Do you have any suggestions on this? Am I doing something wrong?

Thanks in advance!

Posted: Thu Aug 21, 2008 11:40 am
by Pep
Hi Marius,

ok, several options depending on your needs :
1) Use the MarksTipTool : it will allow you to show marks when mouse is over the Series points. Using its events you should be able to customize the Text to appear.
2) Using Annotation tools to show desired text when user click over the Series points ( where you can to control which ones display or not ). Take a look at this post where you can found an example of use.
3) Another way would be to use the OnGetSeriesMark event to customize each mark and decide whether it should be displayed or not (set text as "" to hide marks). This would leave some of the marks displayed at the beginning although.