Page 1 of 1

Hiding legend and NearestPoint (Multiple question)

Posted: Mon Feb 04, 2008 12:21 pm
by 7667185
Hi, I am relatively new to Java and brand new to TeeChart, so after spending a lot of time trying to figure out some minor stuff by reading API and using the TCDemo I thought I'd try my luck here. There are a few things that I am wondering about:

1) When displaying a series of Points, I am not able to hide the Legend (the legend does not show the name of the series, but the value of 12 of the points in the series) by using TChart().getChart().getLegend().setVisible(false);. I also try to remove the entries from the legend by using TChart().getSeries(0).setShowInLegend(false); , but this does not affect anything either... Any hints on how I can remove the Legend from my plot?

2) NearestPoint-question: When I include a NearestPoint-"tracker" on my Point-Series, more than one marker-circle appears in my chart, even though there is only one Series in it. Before I add this single Series, I explicitly removeAllSeries() from the Chart (and/or TChart). Is there any reason why NearestPoint (initiated to either the chart or the particular series) detects points that are not shown in the chart-window? It should be mentioned that the chart, after being instantiated empty, is populated and autoupdated as the user selects various table entries, and the first time the chart displays a series the NearestPoint-tracker only detects one point at the time, the one shown in the chart (as intended)... Any ideas on obvious flaws in my setup of this?

Thanks alot in advance
Marius

Posted: Mon Feb 04, 2008 12:39 pm
by narcis
Hi Marius,

Please find below the answers to your questions:

1. It works fine for me here using this:

Code: Select all

                tChart.getLegend().setVisible(false);
Can you please try if it works fine at your end? Moreover, you can set legend to display series' title like this:

Code: Select all

                tChart.getLegend().setLegendStyle(com.steema.teechart.legend.LegendStyle.SERIES);
2. I'm not able to reproduce the problem here. Could you please send us a simple example project we can run "as-is" to reproduce the problem here? You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.

Posted: Mon Feb 04, 2008 2:44 pm
by 7667185
Thanks for the swift(!) reply Narcis.

In order to fix the first problem, I could not simply set legend.setVisible(false) for some reason, at least not with my code. However, by setting the Points-object p.setShowInLegend() to false I was able to hide the Legend :)

Regarding the second point with the NearestPoint-tracking I will look some more into it, and if I get nowhere I will write some small program which (hopefully) might illustrate. Still, to be sure; when a NearestPoint-object is instantiated using NearestPoint(Series s) it only responds to the closest point of that particular series, right? Guess I need to find out why it reacts to points that obviously arent displayed in the chart but still are considered part of the displayed series...

Best regards

Posted: Mon Feb 04, 2008 3:12 pm
by narcis
Hi Marius,

I'm glad you could solve the legend issue.
when a NearestPoint-object is instantiated using NearestPoint(Series s) it only responds to the closest point of that particular series, right?
Yes, that's correct.