chartjs show dot point on hover over line chart

I am using Chartjs v.1.0.2 and trying to set a point dot only to appear on hover over chart. After it it should be removed. I have managed to show it, by changing the object value, but it is not fluid motion and it doesn’t show point always. This also doesn’t hide it on hover out.
How can it be fluid and hide when mouse is not over?

window.onload = function(){

        var ctx = $("#chart1").get(0).getContext("2d");
                var chart1 = new Chart(ctx).Line(data1, options);


                $("#chart1").hover(function(e) {
                    var activeBars = chart1.getPointsAtEvent(e); 
                    activeBars[0].display = true;
//                    console.log(activeBars[0]);
                    chart1.update();
                 });

    };

    var data1 = {
            labels: ["January", "February", "March", "April", "May", "June", "July"],
            datasets: [
                {
                    label: "My First dataset",
                    fillColor: "rgba(95,186,88,0.7)",
                    strokeColor: "rgba(95,186,88,1)",
                    pointColor: "rgba(95,186,88,1)",
                    pointStrokeColor: "#fff",
                    pointHighlightFill: "#fff",
                    pointHighlightStroke: "rgba(220,220,220,1)",
                    data: [65, 59, 80, 81, 56, 55, 40]
                }
            ]
    };



var options = {
    responsive: true,
    bezierCurve : false,
    scaleShowLabels: false,
    scaleFontSize: 0,
    pointDot : false,
    scaleBeginAtZero: true,
    scaleShowHorizontalLines: false,
    scaleShowVerticalLines: true,
    scaleGridLineColor : "rgba(232,232,232)",
    showTooltips: true,

    customTooltips: function (tooltip) {
        var tooltipEl = $('#chartjs-tooltip');

        if (!tooltip) {
            tooltipEl.css({
                opacity: 0
            });
            return;
        }

        tooltipEl.removeClass('above below');
        tooltipEl.addClass(tooltip.yAlign);

        // split out the label and value and make your own tooltip here
        var parts = tooltip.text.split(":");
        var innerHtml = '<span>' + parts[0].trim() + '</span> : <span><b>' + parts[1].trim() + '</b></span>';
        tooltipEl.html(innerHtml);

        tooltipEl.css({
            opacity: 1,
            left: tooltip.chart.canvas.offsetLeft + tooltip.x + 'px',
            top: tooltip.chart.canvas.offsetTop + tooltip.y + 'px',
            fontFamily: tooltip.fontFamily,
            fontSize: tooltip.fontSize,
            fontStyle: tooltip.fontStyle,
        });
    }

};

simplified fiddle

160 thoughts on “chartjs show dot point on hover over line chart”

  1. Greetings from Los angeles! I’m bored to tears at work so I
    decided to check out your website on my iphone during lunch break.
    I really like the knowledge you provide here and can’t wait to take
    a look when I get home. I’m surprised at how fast
    your blog loaded on my phone .. I’m not even using WIFI, just 3G ..
    Anyways, excellent blog!

    Reply
  2. Excellent article. Keep writing such kind of info on your blog.
    Im really impressed by your site.
    Hey there, You’ve done a great job. I will definitely digg it and
    in my opinion recommend to my friends. I’m sure they will be benefited from this site.

    Reply
  3. Normally I don’t read post on blogs, however I would like
    to say that this write-up very forced me to try and do so!
    Your writing taste has been surprised me.
    Thank you, very great post.

    Reply
  4. I absolutely love your blog.. Pleasant colors & theme.
    Did you develop this website yourself? Please reply back as I’m looking to create my own site
    and would like to find out where you got this from or just
    what the theme is called. Thanks!

    Reply
  5. Great goods from you, man. I’ve remember your stuff previous to
    and you are simply extremely magnificent. I really like what you’ve bought here,
    really like what you are saying and the way wherein you assert it.
    You are making it enjoyable and you continue to take
    care of to stay it wise. I can not wait to read far more from you.
    That is actually a tremendous website. quest bars http://bit.ly/3C2tkMR quest bars

    Reply
  6. I do not know whether it’s just me or if perhaps everybody else encountering problems
    with your website. It appears as though some of the written text in your content are running off the screen. Can someone else please provide feedback and
    let me know if this is happening to them as well? This may be
    a problem with my web browser because I’ve had this happen before.
    Cheers ps4 https://j.mp/3nkdKIi ps4 games

    Reply
  7. Having read this I believed it was very informative.
    I appreciate you taking the time and effort to put this article together.

    I once again find myself spending a significant amount of time both reading and
    leaving comments. But so what, it was still worth it!

    Reply
  8. You actually make it seem so easy with your presentation but I
    find this matter to be actually something which I think I would never understand.
    It seems too complicated and extremely broad for me.
    I’m looking forward for your next post, I will try to get the hang of it!

    Reply
  9. i need a loan desperately today, i need a payday loan direct lender. i need a quick loan today i need loan i need a loan i need a loan, 24 hr cash advance loans, cash advance loans, cash advance online, cash advance loans same day. Investment study of those commerce, terms of credit.

    Reply

Leave a Comment