Skip to content
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

Problem on snap and show tooltip #225

Closed
diraol opened this issue May 9, 2014 · 6 comments
Closed

Problem on snap and show tooltip #225

diraol opened this issue May 9, 2014 · 6 comments
Labels
C-bug Category: This is a bug resolved maybe

Comments

@diraol
Copy link

diraol commented May 9, 2014

Hi friends, I've built a line graph with 5 timeseries and I'm facing a problem with "mouse snap" to some specific date points (it snaps on the points before and after the desired), and then I can't see some legends.

Probably this is because of the "area" of snapping - this could be dynamic (a third of the distance to the other point?) or it could be set on the code.

My code is the following:

var chart = c3.generate({
        padding: {
            top: 30,
            right: 150,
            bottom: 30,
            left: 60
        },
        data: {
            x: 'date',
            x_format : '%d/%m/%Y',
            columns: [
                ['date',"17/03/2014","07/04/2014","08/04/2014","14/04/2014","25/04/2014","26/04/2014","08/05/2014"],
                ["Dilma Roussef", 42, 41, 40, 39, 38, 37, 36],
                ["Aécio Neves", 15, 15, 15, 15, 16, 17, 18],
                ["Eduardo Campos", 7, 7, 8, 7, 9, 8, 9],
                ["Pastor Everaldo", 2, 2, 2, 2, 2, 2, 2],
                ["Outros", 1, 2, 2, 2, 3, 2, 3]
            ],
            colors:{
                "Dilma Roussef":"rgb(204, 0, 0)",
                "Aécio Neves":"rgb(28, 69, 135)",
                "Eduardo Campos":"rgb(230, 145, 56)",
                "Pastor Everaldo":"rgb(106, 168, 79)",
                "Outros":"rgb(140, 86, 75)"
            },
            color: function(color, d) { return color; }
        },
        legend: { position: 'right' },
            axis: {
            x: {
                type: 'timeseries',
                tick: {
                    rotate: 90,
                    format: '%d-%m-%y'
                }
            }
        }
});
@diraol
Copy link
Author

diraol commented May 9, 2014

Try snapping to "2014-04-07" or to "2014-04-25" points.

@lblb
Copy link

lblb commented May 12, 2014

Seems to be a bug in library. The snapping is implemented by generating transparent rectangles for every X value, these rectangles are on the top and are bound to multiple mouse events.The width of event-rects are the same across the chart, which is ok for evenly spaced X values. However for timeseries as in your case they overlap. (http://jsfiddle.net/U4a3E/)

@masayuki0812
Copy link
Member

Hi @diraol @lblb , You're right. This is a bug. I'll fix this. Please give me some time.

@masayuki0812
Copy link
Member

Hi @diraol @lblb , I think this issue has been fixed by the commit above and I released the new version 0.1.42 that includes this commit. Please update and try that one.

@theangrydev
Copy link

I think I am having the same issue in version 0.7.9 - if I have a timeseries where the values are not evenly spaced, then the snapping does not align with where the points actually are

@theangrydev
Copy link

I was able to get something reasonable working with:

tooltip: {
    grouped: false,
    horizontal: true
},
point: {
    sensitivity: 50
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug resolved maybe
Projects
None yet
Development

No branches or pull requests

4 participants