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

dimple.eventArgs doesn't contain any values for line chart #15

Closed
ManneW opened this issue Sep 30, 2013 · 1 comment
Closed

dimple.eventArgs doesn't contain any values for line chart #15

ManneW opened this issue Sep 30, 2013 · 1 comment
Labels

Comments

@ManneW
Copy link

ManneW commented Sep 30, 2013

I'm trying to override the tooltip creation, much like what's done in this example: http://dimplejs.org/advanced_examples_viewer.html?id=advanced_lollipop_with_hover

I'm having a line chart and I construct my axes and series using:

var x = mychart.addTimeAxis('x', 'date', '%Y-%m-%d %H:%I:%S', '%Y-%m-%d'),
    y = mychart.addMeasureAxis('y', 'pageviews'),
    s = mychart.addSeries('id', dimple.plot.line);

Then I attach an eventHandler to the series:

s.addEventHandler("mouseover", displayTooltip);

Where the handler function simply is defined as:

function displayTooltip(e) {
    console.log(e);
}

The output of the console.log command indicates that all the seriesValue, xValue, yValue, zValue and colorValue fields are "undefined".

Also, the mouseover event doesn't seem to be triggered when hovering a point in the line chart – only when hovering the lines.

Is there any additional configuration that is required or something else that I've missed?

I've tried switching to a bubble chart instead (by passing dimple.plot.bubble to addSeries) and when doing that, the values appear correctly in the dimple.eventArgs object.

@johnkiernander
Copy link
Member

Hi, I've just checked this out and it does look like a bug with line and area charts. The custom event handling is applied to the line and not the markers (which carry the information). I'll have a look when I get a chance.

The good news is that you can work around the bug quite easily by using some straight d3. Simply add your event handlers after the draw method has been called as follows:

svg.selectAll("circle").on("mouseover", function (e) { console.log(e); });

You'll notice you get a different event handler object but it will have the same information as the dimple event handler, just with different field names and extra ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants