question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crosshair does not work when xType="time"

See original GitHub issue

The xType=“time” is working great on a LineSeries, but when I attempt to display a Crosshair that appears over the corresponding x-axis value, I get errors due to Date being an object.

The data used by the crosshair values prop is the same as what the LineSeries is receiving.

screen shot 2018-11-01 at 8 38 49 pm

The error message:

screen shot 2018-11-01 at 8 39 04 pm

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
truncscommented, Nov 26, 2018

@ejmudrak I was having the same issue and the way to get around it is by adding a titleFormat to the Crosshair which would convert from a date object to a string which which is a valid react child. This way you don’t disrupt the auto positioning of the crosshair.

            <Crosshair values={crosshair}
              titleFormat={(d) => ({title: 'Date', value: d[0].x.toLocaleDateString()})}
          />
2reactions
ejmudrakcommented, Nov 28, 2018

Thanks a ton @truncs

I had to convert it back to a date, but the Crosshair now positions correctly for dates! I also had to make sure that my function for onNearestX didn’t touch any formatting.

<Crosshair values={ crosshairValues }
              titleFormat={ d => ({
              title: 'Date',
              value: new Date(d[0].x).toLocaleDateString(),
}) } />
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why Pros Use A Custom Crosshair in Fortnite! (Not Bannable?)
Why Pros Use A Custom Crosshair in Fortnite! ( Not Bannable?)In today's video I explain why you've recently seen pros use custom crosshairs...
Read more >
How To Get A Custom Crosshair In Fortnite - YouTube
0:00 Intro0:16 Using a third-party crosshair overlay1:04 Using your gaming monitor's custom crosshairLearn how to get a custom crosshair in ...
Read more >
The BEST Crosshair & Settings For VALORANT - YouTube
Have no idea what the best crosshair and settings are when playing Valorant? This video is for you. Valorant actually gives the user...
Read more >
The BEST PRO Crosshair Settings for Valorant - YouTube
The BEST PRO CROSSHAIR SETTINGS for Valorant that will get you MORE KILLS!▻GET THE RANK YOU'VE ALWAYS WANTED: ...
Read more >
VALORANT on Twitter: "You may have seen your crosshair ...
Not just my settings, but everything reset. Season progression, unlocked characters, items, everything - all gone. It's like I've never launched the game....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found