Page 1 of 1

Possible to draw lines on graph

Posted: Thu Mar 13, 2008 11:41 am
by 15046879
Hi
In our application we have a pane with a CTreeView and a pane with a CTChart. Following a right click on the CTreeView, it becomes possible to draw lines on the CTChart with the mouse.

We use ON_EVENT to catch a TeeChart event including Mouse Button Down. The event in the Graph (derived from CFormView) is caught in the Graph, then the same function in the parent class is called:

ON_EVENT(CSeqGraphView, IDC_TCHART, 19, OnMouseDownTChart, VTS_I4 VTS_I4 VTS_I4 VTS_I4)

We are unsure what class is responsible for putting down extra shapes and lines on a figure. We caught the Mouse Button Down event as you would expect, but don’t know where else to go from here. The graph is intended only to display data. Is there a way that we can ensure it is not possible to draw on it? Any advice gratefully received.

Posted: Mon Mar 17, 2008 9:18 am
by narcis
Hi mjksrl,

We are not 100% sure about which is your exact problem but we think you may be interested on using DrawLine tool. You'll find examples at All Features\Welcome!\Tools\Draw Line in the features demo. Otherwise you should use custom canvas drawing as shown in Tutorial 15 - MS VC++ Applications. Tutorials and demo can be found at TeeChart's program group.

Drawing on graph in application - unwanted functionality

Posted: Mon Mar 17, 2008 9:27 am
by 15046879
Thanks for the reply.

The problem we have is that it IS possible for users of our application to draw on the teechart graph in certain circumstances (as described in the original posting) but we do NOT want this to happen. Is it possible to block users from drawing on the graph in these circumstances?

Thanks again.

Posted: Mon Mar 17, 2008 10:56 am
by narcis
Hi mjksrl,

By default it is not possible for users to draw on a chart. The only thing they may draw is the zooming rectangle and this can be disabled using this code:

Code: Select all

	m_Chart1.GetZoom().SetEnable(false);
If this doesn't help please give us more detailed information of the problem you are having and if possible 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.