When the chart is zoomed in, Highcharts displays points outside the chart area when hovering over the line

I recently began working with highcharts and for my current project, I need a prototype chart that allows zooming in and out. Specifically, I want to display the y-axis value in the tooltip only when the user hovers directly over the points. However, in highcharts, hovering on the line displays the y-axis value of the nearest point in the tooltip. My issue arises when I zoom in to focus on a particular set of points. If I then hover over the line, it shows the y-axis value of points outside the visible chart area.

http://jsfiddle.net/ssaptarshii/hkn8c27n/

$(function () {
$('#container').highcharts({
    chart:{
        zoomType: 'xy'
    },
    title: {
        text: 'Monthly Average Temperature',
        x: -20 //center
    },
    subtitle: {
        text: 'Source: WorldClimate.com',
        x: -20
    },
    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
            'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },
    yAxis: {
        title: {
            text: 'Temperature (°C)'
        },
        plotLines: [{
            value: 0,
            width: 1,
            color: '#808080'
        }]
    },
    tooltip: {
        valueSuffix: '°C'
    },
    legend: {
        layout: 'vertical',
        align: 'right',
        verticalAlign: 'middle',
        borderWidth: 0
    },
    series: [{
        name: 'Tokyo',
        data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
    }]
});

});

When I zoom in so that part of the graph from June to September extends beyond the chart area and then hover over the segment between June and July, the tooltip displays the y-axis value for July which is already off-screen. The y-axis value for July appears near the graph's title.

I do not want to display y-axis values in the tooltip that are outside the zoomed-in chart area, and I also wish to disable the feature of displaying points by hovering over the line.

Answer №1

What do you think of this? Check out the JSFiddle

Here are some additional series options I included:

type: 'scatter',
stickyTracking: false,
lineWidth: 2,

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Creating visually appealing tables in React.js

Having trouble with table rendering in React. The buttons in the table cell are not styled properly and do not center within their div. Additionally, the table border is cut off where there are buttons or empty headers. Need help figuring out what's g ...

Ensure that you patiently wait for the axios method to finish execution before moving on to the

I am currently learning vue.js and struggling with the concept of promises. I need to initialize a variable with data from an API call, but I want to ensure that the Axios call is generic: { data: { list: [], }, methods: { ShowList: function ...

Scroll up event and sticky header using jQuery

I'm working on a function $(document).ready(function () { var lastScroll = 0; $(window).scroll(function(event){ var st = $(this).scrollTop(); if ((lastScroll - st) == 5) { $("header").css("position", "fixed"); ...

Navigating the coordinates for iframe integration in angular js

Hey there! I've been working with Angular and attempting to integrate an iframe. I have tried various methods to insert the longitude and latitude values from the database, but every time I try to input something like this, I encounter an error. Her ...

Having trouble with the numbering system - any suggestions on how to resolve this issue?

I am experiencing an issue with numbering a list .content ol { padding-left: 0px; counter-reset: item; } .content ol > li { display: block; } .content ol > li::before { content: counters(item, ". ") " " ; counter-increment: ...

What is the most effective approach to animating a continuous data stream using Vue.js?

I am currently facing an issue with achieving a seamless animation. My setup involves using Vue.js and Electron, where the main processes are sending data to the renderer process every 16-33ms (equivalent to 30-60fps). Upon receiving this data in my compo ...

Which cleanup function will be called when I have multiple use effects with various effects in use?

I recently started diving into the world of React and have been playing around with React hooks. Imagine a scenario where I have a component with multiple useEffect hooks, each with its own cleanup function. This has raised a few questions for me: ...

Using JSON data in Highstock charts

I am trying to use Highstock to display my data on the web, but I am encountering issues with the JSON data format. You can view an example of a basic line chart here: http://www.highcharts.com/stock/demo/basic-line If I make changes to the JavaScript fi ...

Guide on showcasing an array element from a .js file into a paragraph on an .html document

I'm looking to create a JavaScript function that changes the text displayed every 7 days in the footer of an HTML file. The challenge I'm facing is figuring out how to dynamically update the text inside a paragraph tag in the HTML. myArray = [[i ...

Tips to swap selections in a Select2 dropdown box

Is there a way to dynamically clear a Select2 option list and reload it with new data? Despite setting the data as suggested, it seems to only append the new data without clearing the existing options. $("#optioner").select2(); $("#doit").click(functio ...

Arrange content from database in collapsible Bootstrap 4 cards

Hey there! I'm currently working on developing a shopping cart for a website that will contain products ordered from different companies. You can see an example here: screenshot My goal is to group all products from the same company together, creatin ...

Insufficient column height when using CSS flex-grow property

I am facing an issue with my 3 flex columns that have varying text lengths, resulting in uneven heights. I have tried using flex-grow: 1; to make them match in height, but it does not seem to be working as intended. Can someone please help me identify what ...

The specific div is causing issues with the functionality of the .load jQuery function

Unfortunately, this line is not functioning as intended $('#bookcontainer').load( startSlide ); Conversely, this line works perfectly $(window).load( startSlide ); The element #bookcontainer consists of a collection of four images. Below is ...

Creating a texture from an iframe in three.js

Is it possible to dynamically assign an iFrame as a texture onto an obj model? I know that it can be done with videos. I found this example interesting - where an iFrame is loaded into a three.js environment: And also this example, which demonstrates map ...

Utilizing a React Hook to set data by creating a pure function that incorporates previous data using a thorough deep comparison methodology

I have come across the following code snippet: export function CurrentUserProvider({ children }) { const [data, setData] = useState(undefined); return ( <CurrentUserContext.Provider value={{ data, setData, }} & ...

How can I place this ribbon on top of an image in an HTML email to ensure it displays correctly on email clients such as Outlook?

As I delve into my research, it's becoming apparent that achieving this result might not be feasible across all email clients. However, I'm curious to know if there have been any recent developments in the email world that would allow me to repli ...

Why am I consistently obtaining NaN as the output for the majority of my calculations?

Looking to calculate the average of cities in each state using the Reduce Function in mongoDB, but encountering an issue where only one correct result is obtained while rest return as 'nan'. Below is the map function: function map(){ key = {sta ...

What is the method for configuring my bot to forward all logs to a specific channel?

const logsChannel = message.guild.channels.cache.find(channel => channel.name === 'logs'); I am looking to set up my bot to send log messages for various events, like member join/leave or message deletion, specifically in a channel named &apo ...

What is the best way to resize a div to fit its content if 'clear:both' and 'float:left' are not working as desired?

I've been struggling to find a solution for an issue with my HTML. I have three 'divs' that need to display different information in their own line, enclosed in a parent element with a centered border. Despite trying solutions like inline-bl ...

Supervise the interaction of users on the Express application

Recently, I began using Express and encountered a situation where I have a <table> on the users page with a link in each row to delete the entry. Whenever a user clicks on one of these links, I need to delete that entry from the database. Since this ...