Skip to content

Commit

Permalink
fix ChartIQ hover bug
Browse files Browse the repository at this point in the history
- regression introduced in 9ba05be
- fixes #605
  • Loading branch information
kenkunz committed Oct 12, 2023
1 parent 81931c3 commit c0d5da8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib/chart/ChartIQ.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,19 @@ Dynamically ChartIQ modules (if available) and render chart element.
chartEngine.append('headsUpHR', () => {
const tick = chartEngine.tickFromPixel(chartEngine.cx);
const data = chartEngine.chart.dataSet[tick];
const position = {
cx: chartEngine.cx,
cy: chartEngine.cy,
DateX: data && chartEngine.pixelFromDate(data.DT),
CloseY: data && chartEngine.pixelFromPrice(data.Close)
};
// ChartIQ doesn't preserve original UTC date; restore it from tz-adjusted DT value
data.originalDate = new Date(data.DT.getTime() - data.DT.getTimezoneOffset() * 60000);
if (data) {
data.originalDate = new Date(data.DT.getTime() - data.DT.getTimezoneOffset() * 60000);
}
cursor = { position, data };
});
Expand Down

0 comments on commit c0d5da8

Please sign in to comment.