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

Creating time.bar from example causes TypeError #160

Closed
jme783 opened this issue Mar 13, 2015 · 7 comments
Closed

Creating time.bar from example causes TypeError #160

jme783 opened this issue Mar 13, 2015 · 7 comments
Labels

Comments

@jme783
Copy link

jme783 commented Mar 13, 2015

Hi there,
I'm trying to create a basic real-time bar graph from the library. I installed the package from bower and loaded jQuery and d3 before epoch. However, I am getting an error when trying to run the following simple code from the example:

Ember.$('#event-bar-chart').epoch({
    type: 'time.bar',
    data: [
    // First series
    {
      label: "Series 1",
      values: [{time: 1370044800, y: 100}, {time: 1370044801, y: 1000}]
    },
    // The second series
    {
      label: "Series 2",
      values: [{time: 1370044800, y: 78}, {time: 1370044801, y: 98}]
    }
   ]
});

I receive the following error:

Uncaught TypeError: Cannot read property 'length' of undefined
  Epoch.Time.Plot.a.setData
  Epoch.Time.Stack.a.setData
  ...

It's hard for me to debug this as the JS file is minified. Any ideas on what may be going wrong? Thanks in advance! This seems to happen with any real-time chart I try to use time.area, time.line, etc.

@jme783
Copy link
Author

jme783 commented Mar 13, 2015

It seems like the error is being triggered here in time.coffee:

 _annotateLayers: (prepared) ->
    data = []
    for own i, layer of prepared
      copy = Epoch.Util.copy(layer)
      start = Math.max(0, layer.values.length - @options.historySize)
      copy.values = layer.values.slice(start)
      classes = ['layer']
      classes.push "category#{(i|0)+1}"
      classes.push(Epoch.Util.dasherize layer.label) if layer.label?
      copy.className = classes.join(' ')
      copy.visible = true
      data.push copy
    return data

Specifically on this line: start = Math.max(0, layer.values.length - @options.historySize)

@jme783
Copy link
Author

jme783 commented Mar 13, 2015

This seems to be an issue with the minified version as if I run cake build on the repo then use the unminified version of the library, this issue goes away.

@ryanlitalien
Copy link

+1

@jme783
Copy link
Author

jme783 commented May 18, 2015

@ryanlitalien sadly it doesn't seem like Fastly is maintaining this repo anymore. It's a nice tool but without active maintainers I'm not sure I would recommend continuing to use it

@ryanlitalien
Copy link

Thanks @jme783, I figured as much. I switched to NVD3.js.

@rsandor
Copy link
Collaborator

rsandor commented Oct 4, 2015

Fastly did fail to maintain this project, and after some prodding they were gracious enough to let me back in to work on it. Thanks for digging into the problem some, I will take a look and let you know if I can see what is happening here.

@rsandor rsandor added the bug label Oct 4, 2015
@rsandor
Copy link
Collaborator

rsandor commented Oct 5, 2015

This no longer seems to be an issue after using the new build scripts. I was able to get the chart to correctly render with both the regular and minified versions of the library.

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

3 participants