Reputation: 21
How do you assigned a Series to the Tool Cursor Snap via programming?
I am trying to assign a first Series to Tool cursor snap via programming. I read the document that is state:
ICurstorTool Property Snap: WordBool; Type Library TeeChartx Description Set Snap property to True to align the TCursorTool with the nearest series point. Snap has no effect unless a series is assigned to the Series property.
My code:
m_lCursor1 = pToolList->Add((tchartNS::EToolClass)tcCursor);
tchartNS::IToolsPtr pToolsPtr(pToolList->GetItems(m_lCursor1));
m_pCursor = pToolsPtr->GetasTeeCursor();
m_pCursor->PutStyle((tchartNS::ECursorToolStyle)cssVertical);
m_pCursor->GetPen()->PutEndStyle((tchartNS::EPenEndStyle)esFlat);
m_pCursor->GetPen()->PutColor(RGB(0,120,0));
m_pCursor->PutSnap(VARIANT_TRUE);
m_pCursor->Series = 0; <<<<<<<<< Doesn't assign to Series0?
Upvotes: 0
Views: 274
Reputation: 843
Can you ask your developer to show me how to setup the _variant_t parameter for Series0. I would like to have the cursor snap to series0.
Yes :). To assign the Series to a TeeCursorTool you should create a Variant variable. Then you should assign the Series in that. The code below shows how you can do it:
...
//AssignSeries
VARIANT SourceSeries;
SourceSeries.vt = VT_DISPATCH;
SourceSeries.pdispVal = m_ctrlChart.Series(0);
m_ctrlChart.GetTools().GetItems(0).GetAsTeeCursor().SetSeries(SourceSeries);
Could you tell us if the code works in your end?
Upvotes: 2