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

Works with 3 data points but breaks on 2 #19

Closed
peterbe opened this issue Feb 29, 2012 · 2 comments
Closed

Works with 3 data points but breaks on 2 #19

peterbe opened this issue Feb 29, 2012 · 2 comments

Comments

@peterbe
Copy link

peterbe commented Feb 29, 2012

This works:

var DATA = [
        {y: '2011-04', a: 75, b: 50},
        {y: '2011-03', a: 75, b: 50},
        {y: '2011-02', a: 100, b: 75}];

$(function() {

// quarterly data, custom colors, skinny lines
Morris.Line({
  element: 'container',
  data: DATA,
  xkey: 'y',
  ykeys: ['a', 'b'],
  labels: CATEGORIES,
  //lineColors: ['#167f39','#044c29'],
  lineWidth: 2
});

This draws equally but when I hover over the graph I get an error::

var DATA = [
        // NOTICE how there's only 2 data points this time.
        {y: '2011-03', a: 75, b: 50},
        {y: '2011-02', a: 100, b: 75}];

$(function() {

// quarterly data, custom colors, skinny lines
Morris.Line({
  element: 'container',
  data: DATA,
  xkey: 'y',
  ykeys: ['a', 'b'],
  labels: CATEGORIES,
  //lineColors: ['#167f39','#044c29'],
  lineWidth: 2
});

The error is: z[b][a] is undefined

I'm going to try to find out what the error is in the not-compressed version.

@peterbe
Copy link
Author

peterbe commented Feb 29, 2012

The error is:

[17:13:36.634] seriesPoints[i][index] is undefined @ http://aroundtheworld/static/lib/morris.js?v=7876c:225

Here's the relevant code:

        if (index !== null && prevHilight !== index) {
          for (i = 0, _ref10 = seriesPoints.length - 1; 0 <= _ref10 ? i <= _ref10 : i >= _ref10; 0 <$
(line 225)            seriesPoints[i][index].animate(pointGrow);
          }
          updateHover(index);
        }
        prevHilight = index;
        if (index === null) return hideHover();

@oesmith
Copy link
Contributor

oesmith commented Feb 29, 2012

Should be fixed now in master. A nuance in the implementation got missed when I translated to coffeescript. Schoolboy error on my part!

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

No branches or pull requests

2 participants