Coder Social home page Coder Social logo

Crosshair: Compatibility with Timeline about unovis HOT 3 CLOSED

f5 avatar f5 commented on August 24, 2024
Crosshair: Compatibility with Timeline

from unovis.

Comments (3)

rokotyan avatar rokotyan commented on August 24, 2024

Hi @mattp-

We have the horizontal version of Crosshair in our pipeline, it's not our highest priority though.

Can you please explain how would you like to use it with Timeline? We usually integrate them like this:
Screen Recording 2023-01-18 at 1 17 38 PM

from unovis.

mattp- avatar mattp- commented on August 24, 2024

hi there, yep that looks like what i was looking for. mainly I was actually just looking for a workaround for #103 to get my tooltip to appear. I thought I had it with crosshair until I realized it was not the right axis :)

from unovis.

rokotyan avatar rokotyan commented on August 24, 2024

@mattp- In that case, you'll need to set snapToData to false in Crosshair's config, and provide your own getCircles function for getting the position for the Crosshair circles. It's a bit tricky, but here is an example:

function findDataEntriesAt (x: number): SampleTimelineDatum[] {
  return data.filter(d => (d.time <= x) && ((d.time + d.duration) >= x))
}

function getCircles (x: number, data: SampleTimelineDatum[]): CrosshairCircle[] {
  return findDataEntriesAt(x).map((d, i) => ({
    y: 11 + i * 22 - scrollTop, // If your Timeline is scrollable you'll also need to store its current scrollTop position
    color: d.color,
  }))
}

// Optional: saving the scrollTop position and re-rendering the Crosshair
// Set this function via the `onScroll` config property of Timeline
function onScroll (top: number): void {
  setScrollTop(top)
  crosshairRef.component.render(0)
}

from unovis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.