![]() | Steema Issues DatabaseNote: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;otherwise you can use StackOverflow. Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy. |
| Summary: | Snap cursor APIs fail to snap cursor chart to a series data plot. (TeeChart Pro ActiveX v7 ver7.0.1.4) | ||
|---|---|---|---|
| Product: | ActiveX TeeChart | Reporter: | Mike Dawn <mdawn> |
| Component: | Chart | Assignee: | Steema Issue Manager <issuemanager> |
| Status: | UNCONFIRMED --- | ||
| Severity: | major | CC: | sandra |
| Priority: | Highest | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Chart Series: | Line | Delphi / C++ Builder RAD IDE Version: | |
| Attachments: | Sample of my Teechart setup | ||
Hello, Reviewing the code, you attached, I have seen you doesn’t assign any series to the tool. Also, you need set the CursorTool style property to both, because you can work with Snap propierty in correct way. The simple code below, shows you what need do: TChart1.AddSeries scPoint TChart1.Tools.Add tcCursor TChart1.Series(0).FillSampleValues TChart1.Tools.Items(0).asTeeCursor.SnapStyle = ssVertical TChart1.Tools.Items(0).asTeeCursor.Snap = True TChart1.Tools.Items(0).asTeeCursor.Series = TChart1.Series(0) Finally, I have realized you’re using Teechart Activex v7, could you please, download our Teechart Activex evaluation version from here: https://www.steema.com/downloads/ax And could you check if the problem persists? Thanks in advance Hello Sandra, In my example, I get the tool list and add a cursor to it. I try to set series, but your APIs return a pointer to series and PutSeries(...) function requires VARIANT reference. Can you showed me the correct setup VARIANT value array that needs to pass in into PutSeries(...)? //get tool list tchartNS::IToolListPtr pToolList(m_pChart->GetTools()); //get 1st cursor m_lCursor1 = pToolList->Add((tchartNS::EToolClass)tcCursor); .. m_pCursor->PutStyle((tchartNS::ECursorToolStyle)cssVertical); .. ... m_pCursor->PutSnap(VARIANT_TRUE); ... tchartNS::ISeriesPtr pSeries = m_pChart->GetaSeries(0); pToolList->Items[0]->GetasTeeCursor()->PutSeries(pSeries); <-- How convert to VARIANT values? Can you shown me how. I try to use variant array and I get exception. TChart1.Tools.Items(0).asTeeCursor.SnapStyle = ssVertical TChart1.Tools.Items(0).asTeeCursor.Snap = True TChart1.Tools.Items(0).asTeeCursor.Series = TChart1.Series(0) <--- in C++? Thank you for your help, Mike Hello Sandra, Can you have a C++ developer looking into Series to VARIANT conversion? VB Code: TChart1.Tools.Items(0).asTeeCursor.Series = TChart1.Series(0) <--- in C++? C++ Code: tchartNS::ISeriesPtr pSeries = m_pChart->GetaSeries(0); pToolList->Items[0]->GetasTeeCursor()->PutSeries(pSeries); <-- How convert to VARIANT values? Can you shown me how. I try to use variant array and I get exception. * I also see the question in Stackoverflow website that other developers have same problems. But there is no solutions to the post. Thanks, Mike |
Created attachment 691 [details] Sample of my Teechart setup Dear Steema Software Developer, I am trying to get the snap cursor APIs to work. But Teechart fail to snap cursor to data series. In our code, we create Teechart graph in the dialog box as following steps. I also attach MyTeeChart.cpp as an example for you to see. Can you see my pseudo code and help me as to why put cursor snap APIs fail? Another option, Can you show the manual cursor snap to a fine granularity of 0.5 or 0.025 or 2 X-Axis increments value? I also have Customer Number: I1211707 Teechart Version: TeeChart Pro ActiveX v7 ActiveX control File version: 7.0.1.4 Product Version: 7.0 1) Add one series data to the chart. m_pChart->Series(0)->Clear(); VARIANT* vY = new VARIANT; vY->vt = VT_ARRAY | VT_R8; VARIANT* vX = new VARIANT; vX->vt = VT_ARRAY | VT_R8; long lSize = 0; m_pDisplayArray->BuildDisplayArray(nIndex,lSize,*vY,*vX); <-- Build Variant Array m_pChart->Series(0)->AddArray(lSize,*vY,*vX); <-- Add into Series 0 delete vY; delete vX; 3) Scale X,Y to have 5% padding around the chart graph 2) Add tcCursor to ToolList and then set snap cursor //get tool list tchartNS::IToolListPtr pToolList(m_pChart->GetTools()); //get 1st cursor m_lCursor1 = pToolList->Add((tchartNS::EToolClass)tcCursor); tchartNS::IToolsPtr pToolsPtr(pToolList->GetItems(m_lCursor1)); m_pCursor = pToolsPtr->GetasTeeCursor(); m_pCursorLine1 = pToolsPtr->GetasDrawLine(); 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); <--- Why the cursor is not Snap to the series?