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.

Add API to get chart values (data, markers, etc)

See original GitHub issue

Why is there no getPrice? or getMarkers();

Would really like them, makes it much easyer for me to use.

Example: This is how I need to get the current price now: let currentPrice = Array.from(Array.from(priceArea._dataUpdatesConsumer.de.ee)[priceArea._dataUpdatesConsumer.de.ee.size - 1][1].mapping)[0][1].value;

Just write getPrice(); would make it much more easyer and would have saved me at least 3 hours of searching.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
scrwdrvcommented, Apr 24, 2020

https://jsfiddle.net/nk0412pu/

Again, you should use number at series’ value, toFixed() function returns a string, obviously it’s not gonna work. If you really wanna round up your numbers, try Math.round() instead.

No offence, but I think your major problem is with javascript, you don’t seem to understand the primitive types and having a lot of trouble writing your code in an efficient way. Thus, many of your issues might be caused by that instead of this library.

This is kind of off topic I assumed, yet I suggest you write in Typescript (which is a superset of javascript) to check these potential errors, since this library is written in Typescript the first place and it will very much improve your coding experience by providing better code completion and type checks.

2reactions
scrwdrvcommented, Apr 24, 2020
greenLine.setMarkers([
   {
         time: 2020-4-22,            //This works, but adds a marker to the beginning of the line where the date/time is 2019-4-11.
         position: 'aboveBar',
         color: '#42f54b',
         shape: 'arrowDown',
         text: 'Current price: ' + movingAveragePrice,
         id: 'first',
   },
   {
         time: '2020-4-23',          //This does not work. And does not even show anything.
         position: 'belowBar',
         color: '#f54242',
         shape: 'arrowUp',
         text: 'Current price: ' + movingAveragePrice,
         id: 'second',
   }
]);

It might be just me doing something wrong but I didn’t add such alot of weird things. Just used the normal functions of your library without any other library/plugin or anything included. If I indeed did nothing wrong (which I strongly think) then this is where the real ISSUE is comming to pass.

Well, you basically did everything wrong in this part…

In your code, 2020-4-22 literally means 2020 - 4 - 22 = 1994, which is an integer and will be considered as an UNIX timestamp. And for the second marker, '2020-4-23' should be '2020-04-23' to follow the ISO format of YYYY-MM-DD.

Docs of lightweight-charts might not be great, but definitely good enough to make things running.

Read more comments on GitHub >

github_iconTop Results From Across the Web

API | Chart.js
Triggers an update of the chart. This can be safely called after updating the data object. This will update all scales, legends, and...
Read more >
Excel.Chart class - Office Add-ins - Microsoft Learn
Represents a chart object in a workbook. To learn more about the chart object model, see Work with charts using the Excel JavaScript...
Read more >
Google Visualization API Reference | Charts
Adds a new column to the data table, and returns the index of the new column. All the cells of the new column...
Read more >
Charts — python-pptx 0.6.21 documentation - Read the Docs
python-pptx provides an API for adding and manipulating charts. ... The ValueAxis object providing access to properties of the value axis of this...
Read more >
Insert Links into Google Charts api data? - Stack Overflow
Then when the select event occurs, I just retrieve the link from the original DataTable. <html> <head> <script type="text/javascript" ...
Read more >

github_iconTop Related Medium Post

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