question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Property 'ordinal' of undefined

See original GitHub issue

Hi, I have tried a simple copy-paste example but wouldn’t work. There is this error thrown

ypeError: Cannot read property 'ordinal' of undefined at Object.a.models.discreteBar (nv.d3.min.js:4) at Object.a.models.discreteBarChart (nv.d3.min.js:5) at Object.updateWithOptions (angular-nvd3.min.js:1) at Object.refresh (angular-nvd3.min.js:1) at Object.<anonymous> (angular-nvd3.min.js:1) at Object.fn (angular-nvd3.min.js:1) at n.$digest (angular.min.js:132) at n.$apply (angular.min.js:135)

However, my code in html <nvd3 options="options" data="data"></nvd3>

and dependables in my gulpfile;

        'lib/moment.min.js',
    'lib/d3.min.js',
    'lib/nv.d3.min.js', 
    'lib/angular-nvd3.min.js', 

and the controller looks like

         $scope.options = {
            chart: {
                type: 'discreteBarChart',
                height: 450,
                margin : {
                    top: 20,
                    right: 20,
                    bottom: 50,
                    left: 55
                },
                x: function(d){return d.label;},
                y: function(d){return d.value;},
                showValues: true,
                valueFormat: function(d){
                    return d3.format(',.4f')(d);
                },
                duration: 500,
                xAxis: {
                    axisLabel: 'X Axis'
                },
                yAxis: {
                    axisLabel: 'Y Axis',
                    axisLabelDistance: -10
                }
            }
        };

        $scope.data = [
        {
            key: "Cumulative Return",
            values: [
            {
                "label" : "A" ,
                "value" : -29.765957771107
            } ,
            {
                "label" : "B" ,
                "value" : 0
            } ,
            {
                "label" : "C" ,
                "value" : 32.807804682612
            } , 
            ]
        }
        ]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
sudhirbitsgoacommented, Oct 2, 2016

Hi seems like you are using d3 version 4. Version of 3 are supported.

0reactions
trungjccommented, Aug 6, 2018

thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'ordinal' of undefined for d3.js
I've rewritten my program but the problem seems to be the ordinal scale of d3.js. I don't if because i'm using the v5...
Read more >
Cannot read property 'ordinal' of undefined · Issue #46 - GitHub
When I try to run the sample script on my machine. I get this error: d4.js:95 Uncaught Error: [d4] The scale type: "ordinal"...
Read more >
Angularjs TypeError Cannot read property ordinal of undefined
This article will explain you how to resolve angularjs TypeError: Cannot read property 'ordinal' of undefined. This error is mainly due to “d3”...
Read more >
d3.scaleOrdinal - Observable
First, a definition: a scale is said to be categorical if its domain is a discrete set, and ordinal if that set is...
Read more >
Ordinal number - Wikipedia
In set theory, an ordinal number, or ordinal, is a generalization of ordinal numerals aimed to extend enumeration to infinite sets.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found