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

sparklines never showing.. #96

Open
appaaaa opened this issue Oct 20, 2017 · 3 comments
Open

sparklines never showing.. #96

appaaaa opened this issue Oct 20, 2017 · 3 comments

Comments

@appaaaa
Copy link

appaaaa commented Oct 20, 2017

1


import React, { Component } from 'react'
import { connect } from 'react-redux'
import { Sparklines, SparklinesLine } from 'react-sparklines';

class WeatherList extends Component {
  renderWeather(cityData) {
  //  console.log(cityData)
    const name = cityData.city.name
    const temps = cityData.list.map(weather=>weather.main.temp)

    return (  
      <tr key={name}>
        <td>{name}</td>
        <td>
          <Sparklines height={120} width={180} data={temps}>
            <sparklinesLine color="red" />
          </Sparklines>
        </td>
      </tr>
    )
  }

  render() {
    return (
      <table className="table table-hover">
        <thead>
          <tr>
            <th>City</th>
            <th>Temperature</th>
            <th>Pressure</th>
            <th>Humidity</th>
          </tr>
        </thead>
        <tbody>
          {this.props.weather.map(this.renderWeather)}
        </tbody>
      </table>
    )
  }
}

function mapStateToProps(state) {
  return { weather: state.weather }
}

export default connect(mapStateToProps)(WeatherList)

sparkline never showing..
What's wrong??

@wstell
Copy link

wstell commented Oct 21, 2017

Did you install the wrong version? you are supposed to download 1.6 since 1.7 is broken
npm i --save [email protected]

@appaaaa
Copy link
Author

appaaaa commented Oct 22, 2017

Yes. I'm using 1.6 but never displaying..

@athio92
Copy link

athio92 commented Nov 5, 2017

Look at your SparklinesLine JSX tag. You should capitalize the 's'

<Sparklines height={120} width={180} data={temps}> <sparklinesLine color="red" /> </Sparklines>

Should be <SparklinesLine /> instead of <sparklinesLine />

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

3 participants