Page 1 of 1

setMarkTextResolver for FastLine

Posted: Tue Oct 16, 2007 8:58 am
by 7665742
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,

Posted: Tue Oct 16, 2007 2:00 pm
by narcis
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!

Posted: Wed Oct 17, 2007 7:55 am
by 7665742
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,

Posted: Wed Oct 17, 2007 9:13 am
by narcis
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;
        }