TradingPal / react-native-highcharts

📈 Add Highcharts charts to react-native app for IOS and Android
https://github.com/TradingPal/react-native-highcharts
256 stars 158 forks source link

the horizontal line , not work, help, #59

Open LiuduZero opened 6 years ago

LiuduZero commented 6 years ago

it is my first time to write the issues in github and also first time writing in english,,,

  .then((responseData) => {
        let data = JSON.parse(responseData.data).data,arrX = [],arrY = [], dataXY = [];
        data.forEach(function(v, i) {
           if (i > 0) {
              arrX.push(v[3]);
              arrY.push(v[5]);
              dataXY.push([v[3],v[5]])
           }
        })
        that.setState({
           dataX: arrX,
           dataY: arrY,
           dataXY: dataXY,
        })
     })

'this.state.dataX' and 'this.state.dataY' the the right data,

      chart: {
           type: 'bar',
           height: 3000,
        },
        xAxis: {
           categories: this.state.dataX,
        },
        yAxis: {
           title: {
               text: '数量'
           }
        },
        series: [
          {
              name: '提车数量',
              data: this.state.dataY, //[1,2,34,]
              dataLabels: {
                  enabled: true,
                  rotation: -90,
                  color: '#FFFFFF',
                  align: 'right',
                  format: '{point.y:.1f}', // one decimal
                  y: 10, // 10 pixels down from the top
                  style: {
                      fontSize: '13px',
                      fontFamily: 'Verdana, sans-serif'
                  }
              }
          },
        ],

but when i use the chartView con , I like that, i try to use 'this.state.dataY' to show the series[0].data, it not work, but data like this '[1,2,3,4]' , it work well, 'this.state.dataX' in xAxis.categories works well too,

so, I donot know how to update the datas when i get the responseDate from fetch,

LiuduZero commented 6 years ago

solved , series.data : [1,2,3] not ['1',‘2’,‘3’] 噗噗噗,,,难受,想哭