TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
-
cdn
- Newbie
- Posts: 29
- Joined: Wed Sep 19, 2007 12:00 am
Post
by cdn » Tue Oct 16, 2007 8:58 am
Hi:
We are trying to show ToolTip with customized information using setMarkTextResolver for Financial Indicators. For some reason, we can not show the tooltip with setMarkTextResolver .... but, we can use simple MarksTip. In this chart window we have a Candle, Volume and few Financial Indicators. The Candle's MarkTextResolver works, btw. Here are code excerpts -
Code: Select all
This code works ----
MarksTip tmpTool1 = new MarksTip(tChart2.getChart());
tmpTool1.setSeries(functionSeries);
tmpTool1.setStyle(MarksStyle.VALUE);
Code: Select all
This code does not work ---- here functionseries is a FastLine object
functionSeries.setMarkTextResolver(new com.steema.teechart.styles.Series.MarkTextResolver(){
public String getMarkText(int valueIndex, String markText) {
return "PVO Function:\n" + markText;
}
});
Any information is appreciated. Thank you.
best regards,
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Tue Oct 16, 2007 2:00 pm
Hi cdn,
It works fine for me here adding:
Code: Select all
import com.steema.teechart.styles.Series.MarkTextResolver;
And using some code like this:
Code: Select all
tChart.getSeries(0).getMarks().setVisible(true);
// Example, customize Series marks...
tChart.getSeries(0).setMarkTextResolver( new MarkTextResolver() {
public String getMarkText(int valueIndex, String markText) {
String tmpText = "";
switch (valueIndex) {
case 0: { tmpText = "John"; break; }
case 1: { tmpText = "Ann"; break; }
case 2: { tmpText = "David"; break; }
case 3: { tmpText = "Carol"; break; }
case 4: { tmpText = "David 2"; break; }
}
return tmpText;
}
});
If the problem persists 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!
-
cdn
- Newbie
- Posts: 29
- Joined: Wed Sep 19, 2007 12:00 am
Post
by cdn » Wed Oct 17, 2007 7:55 am
Hi:
Thanks for the response.
I think you missed the point .... The MarkTextResolver works fine just for one series. Our question was - what happens if you have multiple series being displayed in the Chart Window? What we are looking for is - customized tooltips for all the series being displayed.
For example -
We have drawn a chart with
(1) Candle
(2) PVO
(3) Momentum
Now the customized tooltip with setmarkTextResolver only works for "candle" and neither PVO nor Momentum will show customized tooltip output.
So, what we would like to have is all of them to be able to display customized tooltips. Any inputs are appreciated. Thanks.
best regards,
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Wed Oct 17, 2007 9:13 am
Hi cdn,
In that case you should add a customized event handler for each series or a generic one like this:
Code: Select all
for (int i=0; i<tChart.getSeriesCount(); i++)
{
tChart.getSeries(i).getMarks().setVisible(true);
// Example, customize Series marks...
tChart.getSeries(i).setMarkTextResolver( new MarkTextResolver() {
public String getMarkText(int valueIndex, String markText) {
return setMarkText(valueIndex, markText);
}
});
}
Where
setMarkText is:
Code: Select all
public String setMarkText(int valueIndex, String markText) {
String tmpText = "";
switch (valueIndex) {
case 0: { tmpText = "John"; break; }
case 1: { tmpText = "Ann"; break; }
case 2: { tmpText = "David"; break; }
case 3: { tmpText = "Carol"; break; }
case 4: { tmpText = "David 2"; break; }
}
return tmpText;
}