Problem using ClipSeries

TeeChart for ActiveX, COM and ASP
Post Reply
rob14
Newbie
Newbie
Posts: 6
Joined: Mon Mar 03, 2008 12:00 am
Location: UK

Problem using ClipSeries

Post by rob14 » Thu Mar 13, 2008 4:14 pm

Hi

I am using Teechart ActiveX V8 and developing using VC++ 6 with MFC. I am having a problem trying to use the ClipSeries tool.

At the start of my progam where I initialise all the chart parameters I use the following to add the tool:

// now we add a clip series tool
m_Chart.GetTools().Add(tcClipSeries);
m_Chart.GetTools().GetItems(0).SetActive(TRUE);

Then whenerever I add a new series I call the following function to assign the series to the clipping tool:

/* --------------------------------------------------------------------------
ASSIGNCLIPSERIES - This function is called to assign a series to the
clipping tool.
*/
void CChartView::AssignClipSeries(long lSeriesNum)
{
// setup the assignment parameters
VARIANT SourceSeries;
SourceSeries.vt = VT_DISPATCH;
CSeries InputSeries = m_Chart.Series(lSeriesNum);
SourceSeries.pdispVal = InputSeries;

// now assign series and exit
m_Chart.GetTools().GetItems(0).GetAsClipSeries().SetSeries(SourceSeries);
return;

}

However, whenever I run the program I get a TeeChart access violation the first time the AssignClipSeries() function is called. This occurs at the last line of the function, i.e. the SetSeries(...) call. The reported problem is:

First-chance exception in TransView.exe (TEECHART8.OCX): 0xC0000005: Access Violation.

It is probably something stupid I am doing (or have missed out) but I cannot see what is wrong. Any help or working examples would be gratefully received.

Regards

Rob

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Mar 18, 2008 10:49 am

Hi Rob,

to assign the Series you should use similar code to the following :

Code: Select all

    VARIANT TheSeries;
    TheSeries.intVal=0;
    m_chart.GetTools().Add(tcClipSeries);	  
    m_chart.GetTools().GetItems(0).GetAsClipSeries().SetSeries(TheSeries);

rob14
Newbie
Newbie
Posts: 6
Joined: Mon Mar 03, 2008 12:00 am
Location: UK

Post by rob14 » Tue Mar 18, 2008 12:17 pm

Hi Josep,

I have just tried this and I still get the same access violation.

In the code you give above do you not need to specifiy which series you wish to assign to the clipping tool.

Does this mean that I should be adding a new clipping tool for each series I wish to clip, or do I add one clipping tool to the chart and then assign multiple series to that tool.

Many thanks

Rob

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Mar 25, 2008 9:03 am

Hi Rob,

in the code I posted in my last answer I use :
m_chart.GetTools().GetItems(0).GetAsClipSeries().SetSeries(TheSeries);
to assign the the Serie I want to be clipped.
In case you want to clip more than one Series you will need to add a ClipTool to each Series.
Please try to use the same code for each series you want to clip and if you still having problems (getting the error) post a simple example at news://www.steema.net/steema.public.attachments newsgroup or at our upload page with which I can reproduce the problem as is here.

Post Reply