Git Product home page Git Product logo

react-nvd3's Introduction

react-nvd3 Build Status

React component for NVD3 re-usable charting library

Requirements

  • NVD3
  • D3
  • ReactJS

Quick start

<!DOCTYPE html>
<html>
<head>
  <title>BarChart</title>

  <!-- SCRIPTS -->
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.2/nv.d3.min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.1/react-with-addons.min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.1/react-dom.min.js"></script>  
  <!-- You should remove this for production and provide a compiled version of react components -->
  <script src="react-nvd3/dist/react-nvd3.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
  
  <!-- STYLESHEETS -->
  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.1/nv.d3.min.css">

  <style type="text/css">
    #barChart svg {
      height: 400px;
    }
  </style>
</head>
<body>
  <div id="barChart"></div>
  <script type="text/babel">
    ;(function(global){
      var datum = [{
          key: "Cumulative Return",
          values: [
            {
              "label" : "A" ,
              "value" : -29.765957771107
            } ,
            {
              "label" : "B" ,
              "value" : 0
            } ,
            {
              "label" : "C" ,
              "value" : 32.807804682612
            } ,
            {
              "label" : "D" ,
              "value" : 196.45946739256
            } ,
            {
              "label" : "E" ,
              "value" : 0.19434030906893
            } ,
            {
              "label" : "F" ,
              "value" : -98.079782601442
            } ,
            {
              "label" : "G" ,
              "value" : -13.925743130903
            } ,
            {
              "label" : "H" ,
              "value" : -5.1387322875705
            }
          ]
        }
      ];
      ReactDOM.render(
        <NVD3Chart id="barChart" type="discreteBarChart" datum={datum} x="label" y="value"/>,
        document.getElementById('barChart')
      );
    })(window);

  </script>
</body>
</html>

How do I add this to my project?

  • Using bower and running bower install react-nvd3
  • Using npm and running npm install react-nvd3
  • Downloading it manually by clicking here to download minified version

How to use

<NVD3Chart id="barChart" type="discreteBarChart" datum={datum} x="label" y="value"/>

Type (string):

Chart type you want to use. Posible values are:

  • lineChart
  • scatterChart
  • stackedAreaChart
  • discreteBarChart
  • multiBarChart
  • multiBarHorizontalChart
  • linePlusBarChart
  • cumulativeLineChart
  • lineWithFocusChart
  • pieChart
  • bulletChart
  • indentedTree

Datum (array|function):

A collection of data or a function that returns it.

x (string|function)

The key in the collection that should be used as x value or a function that returns it:

  function getX(d){
    return d.label;
  }
  React.render(
    <NVD3Chart id="barChart" type="discreteBarChart" datum={datum} x={getX} y="value"/>,
    document.getElementById('barChart')
  );  

y (string|function)

The key in the collection that should be used as y value or a function that returns it.

margin (object)

To set chart margins you should provide an object with the wanted margins. For example

  React.render(
    <NVD3Chart id="barChart" type="discreteBarChart" datum={datum} margin={{left:200}}/>,
    document.getElementById('barChart')
  );  

Events

ready (function)

A function to be called right after the first transition ends. This event is triggered only once.

renderStart (function)

A function to be called each time the chart rendering starts.

renderEnd (function)

A function to be called each time the chart transition ends.

  React.render(
    <NVD3Chart 
      type="discreteBarChart" 
      datum={datum} 
      renderEnd={mycallbackEnd}
      renderStart={mycallbackStart}
      ready={mycallbackReady} />,
    document.getElementById('barChart')
  );  

Available chart configurations

All the nvd3 configurations for each chart are available. For example if you are using the discreteBarChart then you could show values in this way:

  React.render(
    <NVD3Chart id="barChart" type="discreteBarChart" showValues="true" datum={datum} x="x" y="value"/>,
    document.getElementById('barChart')
  );  

For more information about the available options you could check the nvd3 documentation http://nvd3.org/

NOTICE: An extensive documentation with examples is embeded in the repository https://github.com/novus/nvd3/blob/master/examples/documentation.html . If you want to check it just clone it and open that file.

Configure nested nvd3 components

If you need to configure nested nvd3 components you need to pass a nested object with the configurations to the property that match with the nested component.

Suppose you need to disable tooltips in your charts:

  React.render(
    <NVD3Chart tooltip={{enabled: true}} id="barChart" type="discreteBarChart" showValues="true" datum={datum} x="x" y="value"/>,
    document.getElementById('barChart')
  );

In this case we are passing the nested object to configure the tooltip. This is also applicable to axis components.

Do you want to load a chart from your database?

Since react allow you to use a plain javascript syntax to pass props then you could do this:

var chart = { 
    id:'barChart', 
    type:'discreteBarChart', 
    datum: datum, 
    x: 'label', 
    y: 'value'
};

React.render(
    React.createElement('NVD3Chart', chart),
    document.getElementById('barChart')
);

Or this:

// I've included jQuery here because I want to simplify the code, but it's not required.
$.getJSON('/mychartendpoint/1',function(chart){
    React.render(
        React.createElement('NVD3Chart', chart),
        document.getElementById('barChart')
    );
});

Ok, but what about axis formatters and other functions?

Formatters are functions and we don't want to stored them in a database. If you want to persist your chart state somewhere you need to have a plain json object.

Instead of persist your function implementations in your json you need to create a reference from the json object and pass those functions by context at the moment you instantiate the chart.

Suppose you have a function called getColor to assign the colors in your charts. In this case you'll need to create a context object with the getColor function implementation inside and pass the reference to the color property.

Function references have this format: {name:'functionNameInContext', type:'function'}.

Let's see an example:

var context = {
  getColor: function(i){
    var colors = d3.scale.category20().range().slice(10);
    return colors[Math.floor(Math.random() * colors.length)];    
  }
};

ReactDOM.render(
<NVD3Chart context={context} color={{name:'getColor', type:'function'}} type="discreteBarChart" datum={datum} x="label" y="value" />,
document.getElementById('barChart')
);

Developers

Source code is pretty straightforward. You can take a look at https://github.com/NuCivic/react-nvd3/blob/master/index.js.

Requirements

  • nodejs
  • webpack
  • gulp

Quick start

react-nvd3's People

Contributors

acouch avatar almike avatar benzitohhh avatar dkinzer avatar james-cordeiro avatar kmalakoff avatar ktsn avatar ovvn avatar taymoork2 avatar topicus avatar yuric22 avatar zillding avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-nvd3's Issues

Grid Lines

I'm having an issue with getting grid lines to appear using the x and y Axis props for NVD3Chart. Is it possible to get an example. Features such as tickFormat seems supported but I can't really seem to get grid lines in. Thanks!

Synchronizing tooltip for all charts on same page

Hi,

I have an application where I have 3 charts on same page. (line charts). I need to show tooltip for all 3 charts when I hover mouse over any one of them.

Is there any way to synchronize or link tooltips for multiple charts on same page? (based on X-coordinate).

Quickstart renders only blank pages: ReferenceError: React is not defined

Followed quickstart procedure from bottom README file. Tested on OS X 10.10.5 in Chrome, Safari, and Firefox. All examples show up as blank.

JS Error is:

TypeError: _react2.default is undefined <anonymous> react-nvd3.js:287 __webpack_require__() react-nvd3.js:30 <anonymous> react-nvd3.js:50 <anonymous> react-nvd3.js:11 webpackUniversalModuleDefinition() react-nvd3.js:9 <anonymous> react-nvd3.js:1 react-nvd3.js:287:1

expose legend and tooltip

Currently legend and tooltip are not exposed.

It would be great if they could be exposed as per the yAxis and xAxis. So then they could be accessed like this:

      <NVD3Chart
        type={'lineChart'}
        tooltip={{ keyFormatter: someFn }}
        legend={{ key: someOtherFn }}
      />
    );

As far as I can see, right now the only way to access them is via the configure function:

    function configure(chart) {
      chart.tooltip.keyFormatter(someFn);
      chart.legend.key(someOtherFn);
    }

      <NVD3Chart
        type={'lineChart'}
        configure={configure}
      />

This is really awkward, as it makes overriding defaults difficult.

How do I manage onClick events?

I am attempting to implement onClick events on react-nvd3 components. Is there a way I can use onClick events on a react-nvd3 component?

Linechart

How to add labels and markers for points in the LineChart.

Does d3 need to be a global?

It appears that d3 needs to be a global for react-nvd3 to work, is there any way around this? I was hoping to use

var d3 = require("d3");
var NVD3Chart = require("react-nvd3");

but this does not work.

slices get broken in pieChart

I use filters to update pieChart and slices get broken from time to time. Not sure this is related to nvd3 itself.

I created a dedicated jsfiddle to reproduce the issue. When I click "Change Data" button quickly, then slices get broken.

@topicus I'll appreciate if you take a look at this issue and help me with a workaround when you get a chance. Thanks!

IE 11 Compatibility

I am trying to use the react-nvd3 charts in IE 11 but I am getting the error: Object doesn't support property or method 'startsWith'.

Does this component plan to support IE?

Edit:
I replaced the startsWith with a regular expression and it worked for that but there are some other issues with the chart like the colors not being added unit mouseover.

Broken legend in stackedAreaChart

When I set 'useInteractiveGuideline' to true and click on the chart, the legend that follows the mouse around freezes.

nvd3 was updated to version 1.8.5 recently and I think that might be the cause

Changing chart type is broken

I'm trying to implement the ability for the user to choose between alternative chart types, whilst using the same underlying data. However when the chart changes type it is rendered overlaid on the original chart as seen in this screenshot:

overlaidcharts

For the purpose of demonstrating the issue, I've modified the piechart example from the repository to switch between the discreteBarChart and the original pieChart type as follows (note that for whatever reason the button appears to require being clicked 3 times before the chart changes):

;(function(global){

var pieData = [
  {key: "One", y: 5, color: "#5F5"},
  {key: "Two", y: 2},
  {key: "Three", y: 9},
  {key: "Four", y: 7},
  {key: "Five", y: 4},
  {key: "Six", y: 3},
  {key: "Seven", y: 0.5}
];

var barData = [
  {key: "Cumulative Return", values: pieData}
]

var PieWrapper = React.createClass({
  getInitialState: function() {
    return {pie: false}
  },
  handleClick: function() {
    this.setState({pie: !this.state.pie})
  },
  render: function() {
    const data = (this.state.pie)? pieData: barData;
    const type = (this.state.pie)? "pieChart": "discreteBarChart";
    return (
      <div>
        <button onClick={this.handleClick}>Change Chart</button>
        <NVD3Chart
          id="chart"
          width="600"
          height="370"
          type={type}
          datum={data}
          x="key"
          y="y"
          renderEnd={function(chart, e){console.log( chart.id(), e)}}
          renderStart={function(chart, e){console.log( chart.id(), e)}}
          ready={function(chart, e){console.log( chart.id(), e)}}
        />
      </div>
    )
  }
})

ReactDOM.render(
  <PieWrapper name="wrapper" />,
  document.getElementById('pieChart')
);

})(window);

Fix given examples

Hello,

After installing the module I thought I could use some examples to help me in the beginning. I would be really glad if there were available online, but downloading the project is good enough.

However, I have found most of them do not work as they should. Below I present you a list of my suggestions and/or problems I have faced:

  • examples available online or make examples section in readme and describe how to use them(?)
  • npm install does not install peerDependencies. react and react-dom have to be installed manually
  • barChart: what is "click me" button supposed to do? graph disappears
  • cumulativeLineChart: only "Short" series is visible
  • cumulativeLineChart: Re-scale y-axis does not work
  • lineChart: after clicking "change data", tooltip legend is ghosting with old values
  • multibarChart: grouped or stacked give the same result. add data?
  • pieChart: labels and values are really confusing 😈

Not firing renderEnd on lineChart

Issue encountered on Chrome and Firefox using d3 v3.5.17, nvd3 v1.8.4, and react v15.3.2. Ready and renderStart events fire normally. RenderEnd simply never fires.

I believe React should be in peerDependencies

Hi,
First, thank your for putting this module together, it looks very promising. I was hoping to test it out this evening and ran into a error like this:
Uncaught Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component'srendermethod, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).

Sure enough react-nvd3 has a dependency on react, and apparently this is what peerDependencies are for, so I tested this out and it works just fine then. Any objections to a PR? Or if someone beats me to it, have at it.

Sankey Chart Cannot read property 'renderEnd' of undefined

I am getting the following errors when I try to use Sankey Chart

Uncaught TypeError: Cannot read property 'renderEnd' of undefined
at e.value (react-nvd3.min.js:1)
at e.value (react-nvd3.min.js:1)
at measureLifeCyclePerf (ReactCompositeComponent.js:75)
at ReactCompositeComponent.js:729
at CallbackQueue.notifyAll (CallbackQueue.js:76)
at ReactReconcileTransaction.close (ReactReconcileTransaction.js:80)
at ReactReconcileTransaction.closeAll (Transaction.js:206)
at ReactReconcileTransaction.perform (Transaction.js:153)
at ReactUpdatesFlushTransaction.perform (Transaction.js:140)
at ReactUpdatesFlushTransaction.perform (ReactUpdates.js:89)

and

Uncaught RangeError: Maximum call stack size exceeded
at f (react-nvd3.min.js:1)
at f (react-nvd3.min.js:1)
at f (react-nvd3.min.js:1)
at f (react-nvd3.min.js:1)
at f (react-nvd3.min.js:1)
at f (react-nvd3.min.js:1)
at f (react-nvd3.min.js:1)
at f (react-nvd3.min.js:1)
at f (react-nvd3.min.js:1)
at f (react-nvd3.min.js:1)

The data given was exactly as per the example at : https://github.com/novus/nvd3/blob/master/examples/sankeyChart.html

Event though the above errors are being thrown, I am able to see the chart, but it is not correct.

The other chart types (Line, Bar, Pie) are all working perfectly fine for me.

Use the latest nvd3 source.

The npm module was published 6 months ago. It makes sense to use the latest api in order to utilize new chart components parameters. So I think it makes sense to update 'nvd3' deps to take source from github master branch rather than npm.

stackedAreaChart example.

I have some trouble figuring out how to use the stackedAreaChart.
Could you provide an example for this as well?

Ability to pass key function

Hi, thanks for this great little project, works really well!

I'd like to use a key function in order to achieve object constancy. I don't see a way to do this with react-nvd3, is there a workaround? I think basically react-nvd3 would need to call data instead of datum and allow passing a second argument.

Support for React v15

It'd be nice if react-nvd3 was updated to support React v.15.

Should be as simple as changing the version package.json as there were no deprecation warnings with v0.0.14

Customize tooltip header

Hi,
Is there an option to customize the tooltip header value. Right now the x axis is rendering time, and the tooltip header is showing the x axis value. What i want is to append the the Y-M-D before the original tooltip header. Is that possible

Read all nvd3 settings from (one) common variable?

Hi.

I am coming to React from Angular world and I have been using nvd3/d3 wrappers for Angular as well. Main nvd3 wrapper can be found here: https://github.com/krispo/angular-nvd3

I think it is a good idea to get the best of out of others' ideas and one thing I have particularly liked about angular-nvd3 solution was that one could pass all nvd3 settings rooted in one variable.

Currently, in react it looks like this:

<NVD3Chart type={this.props.graphType}
                 datum={series}
                 showControls={this.props.graphShowControls}
                 useInteractiveGuideline={true}
                 xAxis={{
                    tickValues: ReportGraph.calcTicks(series, 8),
                    tickFormat: (x:number) => DateTimeUtils.format(moment(x), this.props.granularity)
                  }}
                 x="x" y="y"
                 containerStyle={{ height: "500px" }}/>

and I think it would be much easier to work with in this way:

<NVD3Chart options={this.props.options}
                 datum={series}
                 />

and options is simply an object containing all the settings

You can see all the options listed in the examples page, fe: https://krispo.github.io/angular-nvd3/#/lineChart

Does react-nvd3 currently support all the nvd3 options? But they are simply given "one level higher"?
What do you think?

Regards.

Invalid semver version when bower installing

Running bower install react-nvd3 -save throws the error: bower error Invalid Version: 0.5.0.1. Looks like the bower reference should be updated to master (0.5.0.3) and it should also be changed to a valid semver version.

Axis labels and tick formats don't update on React render()

When I pass dynamic values to axis labels and axis tick formats and rerender in React, I notice they don't update. Could it be a NVD3 or D3 thing? Can we override the chart update routine?

I'm thinking of data that comes in with different y-axis value formats (e.g. integer to float, currency, or percent).

Example:

var React = require('react');
var NVD3Chart = require('react-nvd3');
...
var Chart = React.createClass({
  ...
  getInitialState: function () {
    return {
      yAxisLabel: 'Y-axis label',
      yAxisTickFormat: function(d){ return parseFloat(d); }
    };
  },
  ...
  // onDataChange() is called somewhere when data is refreshed
  onDataChange: function (data) {
    this.setState({
      yAxisLabel: data.yAxisLabel,
      yAxisTickFormat: data.yAxisTickFormat
    });
  },
  ...
  render: function() {
    return (
      <NVD3Chart
        ...
        yAxis={{
          axisLabel: this.state.yAxisLabel,
          tickFormat: this.state.yAxisTickFormat
        }}
        ...
      />
    );
  }
});

pieChart example is not working

Hi,

I just clone the v0.5.7 source code and run the charts examples. When I was running the pieChart example in Chrome, I got follow error in the console and the chart not render properly:

d3.min.js:1 Error: Invalid value for attribute transform="translate(NaN,NaN)"

Other charts examples work fine.

Is this a bug for the pieChart?

Cheers,

Linechart viewfinder uses wrong colors if some series are disabled

Let's say you have a line chart with a view finder (focus). You specify colors ['red','green','blue','orange'].
Your 4 data series draws fine, then you click on the 'blue' one in the legend. So it disappears from the chart, but the blue color is still being used in the view finder (orange - the last one - isn't). So at that moment view finder colors don't match the chart colors.

Chart refresh issues

Hi, could you take a look here: https://jsfiddle.net/julians37/0jhhwm0c/

Mouse over the items in the scatter plot and you should see that everything works fine. Now press the button and try again. You should see that the horizontal and vertical lines are not cleaned up properly.

I've tried debugging this and had some success when clearing out the svg element when the chart is re-instantiated, like so:

    if (!this.chart || this.rendering) {
      d3.select(this.refs.svg).select("svg > *").remove();
      this.chart = nv.models[this.props.type]();
    }

This seems to fix the refresh issue, however other issues appear: there seems to be some offset in mouse coordinates and also bogus transitions. And I don't really understand why rendering would be true at this point, perhaps that's the problem?

Nomenclature is a bit ambiguous.

I find the use of the words context, and datum ambiguous.

Javascript already uses context as a defined idea to mean the value of whatever this points to. When I hear context I immediately think of this. Other libraries will sometimes also use the term context, but usually in a similar fashion as to how it's used to refer to this.

I think a more descriptive term would be something like handlers or utils.

As for datum, it is the singular form of data. We should be passing data to our chart components, not a datum. The datum in the data will be used to render the chart.

add callback for nv.addGraph

Hi there,

this library is so useful. Thanks for all the hard work.

But how can a callback be registered with nv.addGraph?

i.e.

nv.addGraph can take a callback argument: https://github.com/novus/nvd3/blob/master/src/core.js#L114

    nv.addGraph(<generate Function>, <callback Function>)

This callback can can be used for extending the functionality of an nvd3 chart. It is a crucial part of the project that I am working on.

As far I can see there is no way to pass this in react-nvd3.

Perhaps it could be exposed as a param?

Example for Bullet Chart

Hi, I tried to render bullet chart but its not showing.
My data

var data = [{
   key: "Revenue",
   value: [
    {"title":"Revenue","subtitle":"US$, in thousands","ranges":[150,225,300],"measures":[220,270],"markers":[250]},
    {"title":"Profit","subtitle":"%","ranges":[20,25,30],"measures":[21,23],"markers":[26]},
    {"title":"Order Size","subtitle":"US$, average","ranges":[350,500,600],"measures":[100,320],"markers":[550]},
    {"title":"New Customers","subtitle":"count","ranges":[1400,2000,2500],"measures":[1000,1650],"markers":[2100]},
    {"title":"Satisfaction","subtitle":"out of 5","ranges":[3.5,4.25,5],"measures":[3.2,4.7],"markers":[4.4]}
   ]
  }]; 

and my component render

<NVD3Chart type="bulletChart"
                datum={data}
                noData="This is not the bullet chart you're looking for"
                width="500" />

Did I pass the wrong dataset?

Thank you for your help

How do I call functions with multiple parameters ?

I need to use the xAxis.ticks function which accepts 2 parameters eg. .ticks(d3.time.weeks, 2). If it was just 1 parameter I could do I what I did with tick format below.
<...... xAxis={{tickFormat : function (d) { return d3.time.format('%Y-%m-%d %H:%M')(new Date(d)) }}} ../>

How do I call multiparameter functions using react-nvd3 ?

IndentedTree Error: Uncaught TypeError: _nvd2.default.models[this.props.type] is not a function

When I try to use the indentedTree chart it generates the following error:
Uncaught TypeError: _nvd2.default.models[this.props.type] is not a function

I am using the same example for indented tree from nvd3.org

Bellow is the code i am using, am I missing something?

        chart = <NVD3Chart 
          type="indentedTree" 
          columns={[
                  {
                    key: 'key',
                    label: 'Name',
                    showCount: true,
                    width: '75%',
                    type: 'text',
                    classes: function(d) { return d.url ? 'clickable name' : 'name' },
                    click: function(d) {
                       if (d.url) window.location.href = d.url;
                    }
                  },
                  {
                    key: 'type',
                    label: 'Type',
                    width: '25%',
                    type: 'text'
                  }
                ]}
                datum={[{
                  key: 'NVD3',
                  url: 'http://novus.github.com/nvd3',
                  values: [
                    {
                      key: "Charts",
                      _values: [
                        {
                          key: "Simple Line",
                          type: "Historical",
                          url: "http://novus.github.com/nvd3/ghpages/line.html"
                        },
                        {
                          key: "Scatter / Bubble",
                          type: "Snapshot",
                          url: "http://novus.github.com/nvd3/ghpages/scatter.html"
                        },
                        {
                          key: "Stacked / Stream / Expanded Area",
                          type: "Historical",
                          url: "http://novus.github.com/nvd3/ghpages/stackedArea.html"
                        },
                        {
                          key: "Discrete Bar",
                          type: "Snapshot",
                          url: "http://novus.github.com/nvd3/ghpages/discreteBar.html"
                        },
                        {
                          key: "Grouped / Stacked Multi-Bar",
                          type: "Snapshot / Historical",
                          url: "http://novus.github.com/nvd3/ghpages/multiBar.html"
                        },
                        {
                          key: "Horizontal Grouped Bar",
                          type: "Snapshot",
                          url: "http://novus.github.com/nvd3/ghpages/multiBarHorizontal.html"
                        },
                        {
                          key: "Line and Bar Combo",
                          type: "Historical",
                          url: "http://novus.github.com/nvd3/ghpages/linePlusBar.html"
                        },
                        {
                          key: "Cumulative Line",
                          type: "Historical",
                          url: "http://novus.github.com/nvd3/ghpages/cumulativeLine.html"
                        },
                        {
                          key: "Line with View Finder",
                          type: "Historical",
                          url: "http://novus.github.com/nvd3/ghpages/lineWithFocus.html"
                        }
                      ]
                    },
                    {
                      key: "Chart Components",
                      _values: [
                        {
                          key: "Legend",
                          type: "Universal",
                          url: "http://novus.github.com/nvd3/examples/legend.html"
                        }
                      ]
                    }
                  ]
                }]}
               tableClass="table table-striped"/>;

showControls doesn't work dynamically

I have this component:

class CommonChart extends React.Component {
  constructor(options) {
    super(options);
    this.state = {show: false};
  }
  onClick = () => {
    this.setState({show: !this.state.show});
  }
  render() {
    return (
      <div>
        <button onClick={this.onClick}>change state</button>
        <span>Show: {""+this.state.show}</span>
        <NVD3Chart showControls={this.state.show} {...this.props}/>
      </div>
    );
  }
}

After first click on the button Controls (Grouped and Stacked) are showing, but after next click they doesn't disappear.
I'm going to investigate it and to try to fix it.

Related to #4 and #5

hmm.. I think this is nvd3 problem

Yes, they just don't remove controls after showControls updating. I'm going to create PR there: novus/nvd3#1413

I don't know who have to update Controls -- react-nvd3 or nvd3.
@topicus , what do you think?

xTickValues is not work!

I need to reduce the x tick values, because they will overlay each other if too many, so I want to use xTickValues, but it not work.

How do I change the scale of my axes?

I am trying to plot a simple line chart displaying average temperatures in different states. The lowest value in my data is 0.3 degrees Celsius, but I would like my y axis to start from the value 0. How do I change the scale of my y Axis to extend beyond the minimum and maximum y values in my data set?

configure not called onComponentDidUpdate

At the moment, this.props.configure is only called onComponentDidMount.

It is not called onComponentDidUpdate.

This is a problem in a project I am working on. For example, we want to change the colour scheme on an update.

update npm package

package.json in npm package doesn't contain last nvd3 version, still github:novus/nvd3#5992b889c6ce8e108d42b73c6382c8863980e34a. @topicus , can you update it, please?

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.