Jump to content
Software FX Community

Dragging the Plot


TPS
 Share

Recommended Posts

 I'm trying to create a feature that allows me to move the time window (the x-axis type is Time)  of the chart busing the mouse, by click and drag. I guess this is a little similar to the scrolling feature of the Windows.Forms version, but "iPhone style" instead of using a scrollbar.

But I have stumbled upon a few problems:

  • In order to move the time window i need to convert the mouse location to a value of the type used by the x-axis. I get that like this:
HitTestResults htr = Chart.HitTest(mousePoint);
Point mousePos = htr.PositionRelativeToPlotArea;
Chart.AxisX.PixelToValue(mousePos.X);

The problem here is that the PositionRelativeToPlotArea returns (0, 0) if the cursor is outside the plot area. Why not just let it return negative values and values that exceeds the boundries of the plot? Or is there another way to get value outside the x-axis min/max range?

 

  • I would like the cursor to be a hand to indicate that the feature is present, but methods I've come up with don't work:

<Style TargetType="{x:Type cfx:PlotAreaAttributes}">
  <Setter Property="Cursor" Value="Hand" />
</Style>

and

<cfx:Chart x:Name="myChart>
<cfx:Chart.PlotArea>
  <cfx:PlotAreaAttributes Cursor="Hand" />
</cfx:Chart.PlotArea>
</cfx:Chart>

 

 Or am I'm perhaps going all wrong about it?

Link to comment
Share on other sites

We have fixed these issues in our current build. PositionRelativeToPlotArea will return negative values or values that exceed the boundaries. Note that IsInsidePlotArea will still return false when appropriate.

Also we are now honoring the Cursor property from PlotAreaAttributes (note that in your build it will not appear in the Intellisense window as we did not handle it)

Please send an email to wpf at softwarefx dot com to request a hotfix.

Regards,

JuanC

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...