ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  How can I identify which layer I am mouse over
Posted by Mike Cotrone on Aug-13-2016 09:47
Hi Peter,

I am trying to make it easy to correlate my mouse over a specific Chart layer so I can draw some additional markers on top.

How can I identify which layer I am over after I get the XCoor? I have a information class that has a bunch of info that belongs to a layer index that I need to coorelate. I am struggling with the linking since I can't easily ID the Layer on mouse over.

Hopefully this makes sense.

Thanks in advance!
Mike

<MOUSE OVER EVENT>

    Dim xValue as Integer = Me.theChart.getNearestXValue(X*f)
    Dim xCoor as Integer = Me.theChart.getXCoor(xValue)

    // LOOP THROUGH OUR LAYERS
    Dim thisChartLayerCount as Integer = Me.theChart.getLayerCount -1
    for i = 0 to thisChartLayerCount

      // GET OUR LAYER
      Dim thisLayer as CDLayerMBS = Me.theChart.getLayerByZ(i)
      Dim xIndex as Integer = thisLayer.getXIndexOf(xValue)

      If MOUSEOVER-LAYER = MYCLASS INDEX THEN // <-- This will allow my to actually pull the right info for the mouse over layer
        Dim thisDataSet as CDDataSetMBS = thisLayer.getDataSet(0)
        // GET Y-COOR
        Dim yCoor as Integer = Me.theChart.getYCoor(thisDataSet.getPosition(xIndex),  thisDataSet.getUseYAxis())
        Me.drawMarkerPoint = New REALbasic.Point(xCoor/f, yCoor/f)
        Me.drawMarker = True
        Me.mouseOverXIndex = xIndex
        Me.mouseOverSessionIndex = i
        Me.Invalidate(False)
        Return
      End If

  Re: How can I identify which layer I am mouse over
Posted by Mike Cotrone on Aug-13-2016 10:03
Attachments:
This is a screen shot of my two layers in one chart.

Thanks Peter.
ss.png

  Re: How can I identify which layer I am mouse over
Posted by Mike Cotrone on Aug-14-2016 04:14
Peter please disregard this as I found my error. I was building my layers slightly wrong that was causing my issues.

Thanks again for all of your help!
Mike

  Re: How can I identify which layer I am mouse over
Posted by Mike Cotrone on Aug-14-2016 04:20
Attachments:
I am now using all Chartdirector Functions for drawing the circle and lines where I used to draw those myself via my paint canvas atop of the chart. Much easier letting CD handle it all in my mouseMove Event.
ss.png

  Re: How can I identify which layer I am mouse over
Posted by Mike Cotrone on Aug-14-2016 04:22
Attachments:
Another SS showing Mouse Over.
ss.png