Comments (2)
Thank you for the JSFiddle example which clearly shows the issue.
I'm adding the 'needs investigation' label because we will need to discuss internally whether a change to this behaviour should be the default and expected behaviour going forward, or whether we should put the new behaviour behind an option.
I can see a benefit to both approaches. Additionally, the fact that the behaviour is different for the past (left) direction compared to the future direction is unexpected.
from lightweight-charts.
One solution to this is to have all of the area that you want scrollable as whitespace data and the very last data a line data with a NaN
value.
Like so:
const whitespaceStartDate = "1970-01-01";
const whitespaceEndDate = "2100-01-01";
const whitespaceDateDataset: ((WhitespaceData | SingleValueData) & Numbered)[] =
new Array(
getNumberOfDaysBetweenTwoDates(
new Date(whitespaceStartDate),
new Date(whitespaceEndDate),
),
);
// Hack to be able to scroll freely
// Setting them all to NaN is much slower
for (let i = 0; i < whitespaceDateDataset.length; i++) {
const date = new Date(whitespaceStartDate);
date.setUTCDate(date.getUTCDay() + i);
const number = date.valueOf() / ONE_DAY_IN_MS;
const time = dateToString(date);
if (i === whitespaceDateDataset.length - 1) {
whitespaceDateDataset[i] = {
number,
time,
value: NaN,
};
} else {
whitespaceDateDataset[i] = {
number,
time,
};
}
}
from lightweight-charts.
Related Issues (20)
- Optimisation question about multiple addLineSeries HOT 7
- Chart.show() not working in spyder (python) HOT 1
- How to build ? HOT 2
- Markers @ price HOT 2
- series.data() does not return whitespace data HOT 3
- Custom priceFormatter causes line to disappear when no data variance HOT 2
- Plot a rectangle (with the plugin) HOT 6
- Months / days disappear on timescale sometimes HOT 1
- How to create a pine script vs lightweight-charts HOT 1
- Allow changing time scale text color HOT 1
- Feature request: More flexibility for scatter plots
- Line gaps not working in version 4.2 but work in version 3.8 HOT 1
- Best way to detachPrimitive and remove markers HOT 2
- setVisibleLogicalRange doesn't work inside subscribeSizeChange callback
- Improve error message for: Error: Value is null at ensureNotNull (lightweight-charts.development.mjs:205:15) HOT 16
- Allow AREA series to be "infinite" horizontally ( like price lines ) HOT 2
- Realign marker text if cut by fixed edge
- Line Break in a marker Text HOT 2
- Uncaught TypeError TypeError: Cannot read properties of undefined (reading '_internal_state') HOT 1
- The curve and time axis jitter when moving left HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lightweight-charts.