Problem using ClipSeries
Posted: 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
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