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

xScale throwing error while passing ordinal #38

Open
neolivz opened this issue Aug 1, 2016 · 3 comments
Open

xScale throwing error while passing ordinal #38

neolivz opened this issue Aug 1, 2016 · 3 comments

Comments

@neolivz
Copy link

neolivz commented Aug 1, 2016

If xScale="ordinal" is throwing error
Failed prop type: Invalid prop xScale of value band supplied to Grid, expected one of ["linear","identity","sqrt","pow","log","quantize","quantile","ordinal","time"].

This is due to bug in react core
react-d3/react-d3-core#36
which is fixed in version 1.3.1

@strobox
Copy link

strobox commented Aug 28, 2016

Met this issue with react-d3-core 1.3.9

@helsont
Copy link

helsont commented Dec 7, 2016

What's the deal with this: https://github.com/react-d3/react-d3-shape/blob/master/src/chart.jsx#L71 .

Trying to run the BarChart example and im getting this:

Warning: Failed prop type: Invalid prop `xScale` of value `band` supplied to `Grid`, expected one of ["linear","identity","sqrt","pow","log","quantize","quantile","ordinal","time"].

Pretty sure that the line I selected says why the prop type is invalid.

import React from 'react';

import {
  BarChart
} from 'react-d3-basic';

import d3 from 'd3';
import moment from 'moment';

import {
  tsvParse
} from 'd3-dsv';

const letterData = `letter	frequency
A	.08167
B	.01492
C	.02782
D	.04253
E	.12702
F	.02288
G	.02015
H	.06094
I	.06966
J	.00153
K	.00772
L	.04025
M	.02406
N	.06749
O	.07507
P	.01929
Q	.00095
R	.05987
S	.06327
T	.09056
U	.02758
V	.00978
W	.02360
X	.00150
Y	.01974
Z	.00074`;

class LeadSources extends React.Component {
  constructor(props) {
    super(props);
  }
  renderBarGraph() {
    let generalChartData = tsvParse(letterData);

    let width = 960,
      height = 500,
      title = 'Bar Chart',
      chartSeries = [
        {
          field: 'frequency',
          name: 'Frequency'
        }
      ],
      x = function (d) {
        return d.letter;
      },
      xScale = 'ordinal',
      xLabel = 'Letter',
      yLabel = 'Frequency',
      yTicks = [10, '%'];

    return (<BarChart
      title= {title}
      data= {generalChartData}
      width= {width}
      height= {height}
      chartSeries = {chartSeries}
      x= {x}
      xLabel= {xLabel}
      xScale= {xScale}
      yTicks= {yTicks}
      yLabel = {yLabel}
    />);
  }
  render() {
    return this.renderBarGraph();
  }
}

export default LeadSources;

@crobinson42
Copy link

I'm still experiencing this issue - any help or direction on this?

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

4 participants