Page 1 of 1

Can we delete Financial Functions?

Posted: Wed Oct 10, 2007 5:54 am
by 7665742
Hi:

We are trying to be able to delete financial indicators (ex. POV, Momentum etc.) after they are drawn inside a chart window so we get enough real estate to draw another indicator. And, we are using FastLine to draw these indicators. Is it possible to select the indicators and delete them? We could able to select and delete a line. But, not able to provide similar functionality associated to FastLine. Any inputs/insights are appreciated. Thanks.

regards,
vasu

Posted: Wed Oct 10, 2007 9:49 am
by narcis
Hi vasu,

I'm not sure if that's what you are looking for exactly but you can remove any TeeChart series like this:

Code: Select all

                tChart.getSeries().remove(fastLine1);
or

Code: Select all

                tChart.getSeries().remove(0);
If this doesn't help don't hesitate to let us know.

Re: Can we delete Financial Functions?

Posted: Wed Oct 10, 2007 12:22 pm
by 7665742
Thanks, Narcis for the response. BTW, that is what we are currently doing (this is not the ideal solution).

But, how can we select the particular the FastLine? Once we select the indicator, then we can give right mouse click (drop-down) for deleting the selected fastline. So, the flow is -

draw_indicator -> select_indicator -> delete_indicator (is need be) .

Is this feasible? Thanks.

regards,
vasu

Posted: Wed Oct 10, 2007 2:30 pm
by narcis
Hi vasu,

Yes, you can add mouse events like this:

Code: Select all

                tChart.addMouseListener(new java.awt.event.MouseListener() {
                    public void mouseClicked(MouseEvent e) {
                        tChartMouseListened(e);
                    }
                    public void mouseEntered(MouseEvent e) {
                    }
                    public void mouseExited(MouseEvent e) {
                    }
                    public void mousePressed(MouseEvent e) {
                    }
                    public void mouseReleased(MouseEvent e) {
                    }
                });
And then implement tChartMouseListened:

Code: Select all

        private void tChartMouseListened(java.awt.event.MouseEvent e)
        {
            //Clicked button is right-button
            if (e.getButton() == e.BUTTON3)
            {
            for (int i=0; i<tChart.getSeriesCount(); i++)
                {
                    if (tChart.getSeries(i).clicked(e.getX(),e.getY()) != -1) {
                        tChart.getSeries().remove(i);
                        tChart.refreshControl();
                    }
                }
            }
        }

Posted: Tue Nov 13, 2007 6:47 am
by 7665742
Hi Narcis:

Thanks for the answer. This solution works great. Appreciate it much.

Now, what we need is - somehow able to show the user that particular series is selected as we have quite a few series close by. So, we are wondering whether we could show the user some sort of selected indication on a series when it is clicked to get deleted. Appreciate any information you can provide.

best regards,

Posted: Tue Nov 13, 2007 10:53 am
by narcis
Hi cdn,

An option would be that you increased selected series pen size to mark it, for example:

Code: Select all

            series.getLinePen().setWidth(3);

Posted: Tue Nov 13, 2007 12:29 pm
by 7665742
Hi:

Thanks for the response. But how do we get access to "getLinePen()"? That seems to be only accessible for FastLine and Axes etc. not for Series. We poked around the API, but we could not locate the place where we could set the pen width.

best regards,

Posted: Tue Nov 13, 2007 12:55 pm
by narcis
Hi cdn,

In that case you can typecast your series like this:

Code: Select all

((com.steema.teechart.styles.FastLine)tChart.getSeries(0)).getLinePen().setWidth(3);