Home forums Using CanvasJS mouseover help

Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #28151

    I have a specific <td id=”test”> element below the graph that I am trying to change the color when a specific line is highlighted.

    Looking at the examples, I am trying something along the lines of

    mouseover: function(){
    document.getElementById("test").style.backgroundColor='red';
    },

    But it’s not working and I am afraid there is something that I don’t understand. hoping to see if I am doing something stupid, or perhaps this just isn’t possible.

    Thanks!

    #28163

    @wstewart3,

    The above code seems to be working fine at our end. Can you please create and share a JSFiddle reproducing the issue so that we can look into your code and help you out.

    ___________
    Indranil Deo
    Team CanvasJS

    #28164

    So, I am getting a weird thing on my line graphs, where When I initially mouseover the line, it does nothing, but when I move to another point, then it fires off.

    However, another part of my problem was I did not want ID, I needed to do this by the object class:

    mouseover: function color() {
    var elements = document.getElementsByClassName(‘test’); // get all elements
    for(var i = 0; i < elements.length; i++){
    elements[i].style.backgroundColor = “red”;
    }
    },

    end result for your bar graph can be seen here:
    https://jsfiddle.net/h28xmnfy/

    Will do some more testing and get back to everyone. Thanks for the quick response!

    #28175

    Looks like things are, in fact, mostly working as intended.

    However, is it possible to make it so the “mouseover” function triggers anywhere on the line, not just the datapoint itself?
    https://jsfiddle.net/4uodvpf2/

    My goal is to try and highlight the area of a table whose data is represented by said line. This would seem to work best whenever mousing over any part of the line.

    #28193

    @joran,

    In case of line chat, each dataPoint is represented as a marker and a line connects them. Events (click, mouseover, mousemove, mouseout) binded for dataPoints get fired when mouse event is triggered on it and not on the connecting line.

    ___________
    Indranil Deo
    Team CanvasJS

    #28194

    Gotcha,

    So currently it’s not possible?

    Thanks for the replies! I have been enjoying CanvasJS.

    #28209

    @joran,

    Sorry, adding a mouse event to the line of a line chart is not available as of now.

    ___________
    Indranil Deo
    Team CanvasJS

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.