Can't make cursortool work in WPF
Posted: Fri Aug 07, 2009 4:35 pm
I am porting a TeeChart application from Delphi to WPF/dotNET. I cannot get the cursor tool to work with WPF.
Here is a code snippet. During execution, the P.Y coordinate is always negative, and I never get match = true; I have uploaded my complete application for another issue that Sandra is investigating (3D rotation crash). To enable the cursor tool in that application, choose the icon from the bottom toolbar that looks like a crosshair (7th from the left).
I also tried the method of registering a callback like the following, but it is never called.
ChartTool1.Change += new Steema.TeeChart.WPF.Tools.CursorChangeEventHandler(ChartCursor_Change);
public void ChartCursor_Change(object sender, Steema.TeeChart.WPF.Tools.CursorChangeEventArgs e) {}
Here is a code snippet. During execution, the P.Y coordinate is always negative, and I never get match = true; I have uploaded my complete application for another issue that Sandra is investigating (3D rotation crash). To enable the cursor tool in that application, choose the icon from the bottom toolbar that looks like a crosshair (7th from the left).
Code: Select all
// P=FChartTimeSeries.ChartDisplay.GetCursorPos();
P = FChartTimeSeries.ChartDisplay.PointFromScreen(e.MouseDevice.GetPosition(this));
ecount = GetActiveEventCount(); // number of active events
// Compare mouse location to each point in each series
for(i=0; i< FChartTimeSeries.ChartDisplay.Series.Count; i++)
{
match = FChartTimeSeries.ChartDisplay.Series[i].Clicked(P.X,P.Y);
if (match != -1) // match is matching record in series
{
FChartTimeSeries.CursorTool.Series = FChartTimeSeries.ChartDisplay.Series[i];
if((!isCBEMA) &&
!(FChartTimeSeries.ChartDisplay.Series[i] is Steema.TeeChart.WPF.Styles.Bar))
{
match = FChartTimeSeries.CursorTool.SnapToPoint(); // not a point series, must identify data point
}
myX = FChartTimeSeries.ChartDisplay.Series[i].XValues[match];
myY = FChartTimeSeries.ChartDisplay.Series[i].YValues[match];
I also tried the method of registering a callback like the following, but it is never called.
ChartTool1.Change += new Steema.TeeChart.WPF.Tools.CursorChangeEventHandler(ChartCursor_Change);
public void ChartCursor_Change(object sender, Steema.TeeChart.WPF.Tools.CursorChangeEventArgs e) {}