-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After removing line form the chart getting issue . #1406
Comments
You could try use the development build of the library to get a more useful error message. |
Thx, I will check. Thx for your help. |
I'm closing this issue since there hasn't been any new messages. |
Hi, The issue is there in the API ver: TradingView Lightweight Charts™ v4.0.1. If you run my example you will see. |
@SlicedSilver Hi, I think I'm facing a similar problem. Could you please take a look at a minimally reproducible example? The problem in the example is reproduced when subscribing to crosshair move in the chart and creating any series with the price line. If we are now focused on the price line and at the same time we delete the series, then we get an error. It seems that the link to the price line remains in the subscription and is not cleared until we move the cursor beyond the border of the chart. The thickness of the price line is intentionally made 15 pixels to make it easier to aim at it, but with a thickness of 1 pixel the problem is also reproduced :) lightweight-charts version: Screen.Recording.2024-02-28.at.10.21.45.mov |
Lightweight Charts™ Version:
Steps/code to reproduce:
<script type="text/javascript" src="https://unpkg.com/lightweight-charts/dist/lightweight-charts.standalone.production.js"></script> <style> #myDiv { width: 400px; height: 400px; border: 2px solid black; } </style> <script type="text/javascript">`
var chart = LightweightCharts.createChart(document.body, {
width: 900,
height: 600,
grid: {
vertLines: {
color: 'rgba(197, 203, 206, 0.5)',
},
horzLines: {
color: 'rgba(197, 203, 206, 0.5)',
},
},
crosshair: {
mode: LightweightCharts.CrosshairMode.Normal,
},
rightPriceScale: {
borderColor: 'rgba(197, 203, 206, 0.8)',
},
timeScale: {
borderColor: 'rgba(197, 203, 206, 0.8)',
},
localization: {
dateFormat: 'yyyy-MM-dd',
},
});
chart.subscribeClick(myClickHandler);
chart.subscribeCrosshairMove(myMouseMoveHandler);
var candleSeries = chart.addCandlestickSeries({
upColor: 'rgba(255, 144, 0, 1)',
downColor: '#000',
borderDownColor: 'rgba(255, 144, 0, 1)',
borderUpColor: 'rgba(255, 144, 0, 1)',
wickDownColor: 'rgba(255, 144, 0, 1)',
wickUpColor: 'rgba(255, 144, 0, 1)',
});
candleSeries.setData([
]);
let m_line = [];
let m_linemk = [];
let o1 = {
time: '2019-04-22',
value: 205,
};
m_line.push(o1);
let o2 = {
time: '2019-05-16',
value: 205,
};
m_line.push(o2);
// Add markers
let m1 = {
id: '123',
time: '2019-04-22',
position: 'inBar',
color: 'rgba(0, 0, 255, 1)',
shape: 'circle',
};
m_linemk.push(m1);
let m2 = {
id: '123',
time: '2019-05-16',
position: 'inBar',
color: 'rgba(0, 0, 255, 1)',
shape: 'circle',
};
m_linemk.push(m2);
line_1 = chart.addLineSeries({
color: 'rgba(0, 0, 255, 1)',
lineWidth: 2,
lastValueVisible: false, // hide value from y axis
priceLineVisible: false,
crosshairMarkerVisible: true,
});
line_1.setData(m_line);
line_1.setMarkers(m_linemk);
console.log(line_1);
function myClickHandler(e){
}
function myMouseMoveHandler(e){
}
</script>`
Actual behavior:
When I click on the dot to delete the line on the chart getting error in the console browser.
Iam getting this if I subscribed to : chart.subscribeCrosshairMove(myMouseMoveHandler);
If Iam moving the mouse on the chart getting error messages in the console.
Expected behavior:
Removing the line.
Screenshots:
The text was updated successfully, but these errors were encountered: