Coder Social home page Coder Social logo

Comments (8)

krispo avatar krispo commented on August 17, 2024

Can you show me your js and html code?

from angular-nvd3.

faisalferoz avatar faisalferoz commented on August 17, 2024

html code is:
<nvd3 options="options" data="data"></nvd3>

and controller has the following code:

$scope.options = {
    chart: {
      type: 'multiBarHorizontalChart',
      height: 300,
      margin: {
        top: 20,
        right: 20,
        bottom: 60,
        left: 55
      },
      x: function(d) {
        return d.name;
      },
      y: function(d) {
        return d.label;
      },
      showControls: true,
      showValues: false,
      transitionDuration: 500,
      valueFormat: function(d) {
        return d.toFixed();
      },
      xAxis: {
        showMaxMin: false
      },
      yAxis: {
        axisLabel: 'Counts',
        tickFormat: function(d) {
          return d.toFixed();
        }
      }
    }
  };

$scope.data = [
            {
                "key": "Series1",
                "color": "#d62728",
                "values": [
                    {
                        "label" : "Group A" ,
                        "value" : -1.8746444827653
                    } ,
                    {
                        "label" : "Group B" ,
                        "value" : -8.0961543492239
                    } ,
                    {
                        "label" : "Group C" ,
                        "value" : -0.57072943117674
                    } ,
                    {
                        "label" : "Group D" ,
                        "value" : -2.4174010336624
                    } ,
                    {
                        "label" : "Group E" ,
                        "value" : -0.72009071426284
                    } ,
                    {
                        "label" : "Group F" ,
                        "value" : -0.77154485523777
                    } ,
                    {
                        "label" : "Group G" ,
                        "value" : -0.90152097798131
                    } ,
                    {
                        "label" : "Group H" ,
                        "value" : -0.91445417330854
                    } ,
                    {
                        "label" : "Group I" ,
                        "value" : -0.055746319141851
                    }
                ]
            },
            {
                "key": "Series2",
                "color": "#1f77b4",
                "values": [
                    {
                        "label" : "Group A" ,
                        "value" : 25.307646510375
                    } ,
                    {
                        "label" : "Group B" ,
                        "value" : 16.756779544553
                    } ,
                    {
                        "label" : "Group C" ,
                        "value" : 18.451534877007
                    } ,
                    {
                        "label" : "Group D" ,
                        "value" : 8.6142352811805
                    } ,
                    {
                        "label" : "Group E" ,
                        "value" : 7.8082472075876
                    } ,
                    {
                        "label" : "Group F" ,
                        "value" : 5.259101026956
                    } ,
                    {
                        "label" : "Group G" ,
                        "value" : 0.30947953487127
                    } ,
                    {
                        "label" : "Group H" ,
                        "value" : 0
                    } ,
                    {
                        "label" : "Group I" ,
                        "value" : 0
                    }
                ]
            }
        ]

from angular-nvd3.

faisalferoz avatar faisalferoz commented on August 17, 2024

My bower.json has these dependencies

"d3": "~3.4.11",
"nvd3": "~1.1.15-beta",
"angular-nvd3": "~0.0.8"

from angular-nvd3.

krispo avatar krispo commented on August 17, 2024

The "x" and "y" function definition don't match with data.
Change it to:

x: function(d) {
        return d.label;
      },
y: function(d) {
        return d.value;
      },

from angular-nvd3.

faisalferoz avatar faisalferoz commented on August 17, 2024

oh my bad - even after that the control don't work as expected.

from angular-nvd3.

krispo avatar krispo commented on August 17, 2024

it is working in plunker)

from angular-nvd3.

faisalferoz avatar faisalferoz commented on August 17, 2024

:) no worries i will debug it out to see whats happening.

from angular-nvd3.

faisalferoz avatar faisalferoz commented on August 17, 2024

Found the issue - it isn't related to the directive or any of the nvd3, d3 code. nvd3 adds a disabled class over the control, legend that is clicked to act as a toggle. I had a disabled class in my css that was disabling the pointer-events which was causing all the issues. I fixed it up and things are working as expected.

from angular-nvd3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.