Home Forums WinForms controls Xceed Chart for WinForms Show chart coords as mouse moves over surface?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #18952 |

    I have a form with a chart control, and I would like to show the X and Y values which correspond to the mouse position as the user moves the mouse over the chart within the control.  I have seen some of the other posts relating to similar things, but they seem to require that there be at least one series plotted.  I may or may not have a series plotted.  But I have set the Min and Max values for both X and Y axes, so I know what the bounds are.  I’m using the MouseMove event, but I can’t see a property of the HitTestResult object that will give me the X and Y chart values at the mouse location.

    What’s the right way to do this?

    Imported from legacy forums. Posted by Steve (had 1630 views)

    User (Old forums)
    Member
    Post count: 23064

    Solved my own problem – always the best way!

    The DataCursorTool is what I need, of course.

    Imported from legacy forums. Posted by Steve (had 528 views)

    User (Old forums)
    Member
    Post count: 23064

    But I do seem to have a problem….

    Sometimes my X axis uses the Logarithmic scale mode, and sometimes Numeric scale mode.  If I use Numeric it all works fine.  But if I use the Logarithmic, the XAxisValue never seems to change in the DataCursorChanged event – what it gives me for X is the log of the Max value on the X axis.

    I am setting the Min value to 30 and the Max to 300 for the X axis.  I have tried setting the scalemode before setting the min and max, and after.  No difference.  This is all done in code, not at design time.  This is probably me, but it is all pretty simple, so I can’t see the problem.  Any suggestions welcome.

    [Added later] I’ve just tried setting the DataCursorTool up at design time, and only attaching the handler for the DataCursorChanged event at runtime.  Same result. The order in which things are done is this:

    1. Create an instance of the form containing the chart object
    2. Set the axis bounds and scaletype (depends on data)
    3. Show the form
    4. In the Load event for the form, attach a handler for the DataCursorChanged event of the DataCursorTool.

    I have also tried setting the scalemode and axis bounds at design time instead of in code, but that doesn’t help either.

    Imported from legacy forums. Posted by Steve (had 676 views)

    User (Old forums)
    Member
    Post count: 23064

    OK, I seem to have solved this one too.  I changed the ClampValuesToRuler property of the DataCursorTool to False, and now it seems to work OK.  I wasn’t deliberately setting it to anything before, so I guess it must have defaulted to True.  But I realise I don’t really understand what this property does – what does “clamp values to ruler” actually mean?  And why was it stopping the X value from changing when it was True?

    Imported from legacy forums. Posted by Steve (had 2203 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.