Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/477.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Apexcharts-React js Unhandled拒绝(TypeError):t.every不是一个函数_Javascript_Reactjs_Apexcharts - Fatal编程技术网

Javascript Apexcharts-React js Unhandled拒绝(TypeError):t.every不是一个函数

Javascript Apexcharts-React js Unhandled拒绝(TypeError):t.every不是一个函数,javascript,reactjs,apexcharts,Javascript,Reactjs,Apexcharts,我试图使用Apexcharts将动态数据设置到饼图中,但遇到了一个错误 class ApexChartPie1 extends React.Component { constructor(props) { super(props); this.state = { series: this.state={ dataL : [] }, options: { chart: {

我试图使用Apexcharts将动态数据设置到饼图中,但遇到了一个错误

class ApexChartPie1 extends React.Component {
    constructor(props) {
      super(props);
 
      this.state = {
        series: this.state={
          dataL : []
        },
        options: {
          chart: {
            width: 380,
            type: 'pie',
          },
          labels: ['LOST', 'WON'],
          responsive: [{
            breakpoint: 480,
            options: {
              chart: {
                width: 200
              },
              legend: {
                position: 'bottom'
              }
            }
          }]
        },         
      };
    }

  
    async componentDidMount(){
      axios.get("http://localhost:8080/designe/pieone")
      .then(response => response.data)
      .then((data) =>{
        this.setState({dataL : data})
      })
    }

    render() {
      return (
        <div id="chart">
          <ReactApexChart options={this.state.options} series={this.state.series} type="pie" width={380} />
        </div>
      );
    }
  }
类ApexChartPie1扩展了React.Component{ 建造师(道具){ 超级(道具); 此.state={ 系列:本州={ 数据:[] }, 选项:{ 图表:{ 宽度:380, 键入“pie”, }, 标签:[“丢失”、“赢得”], 响应:[{ 断点:480, 选项:{ 图表:{ 宽度:200 }, 图例:{ 位置:'底部' } } }] }, }; } 异步组件didmount(){ axios.get(“http://localhost:8080/designe/pieone") .then(response=>response.data) 。然后((数据)=>{ this.setState({dataL:data}) }) } render(){ 返回( ); } } 我得到的错误是:


React js Unhandled Rejection(TypeError):t.each不是一个函数

我看到的一个问题是,您正在嵌套对此的引用。state和Apexcharts正在寻找
系列
作为图表值数组

您可以尝试在构造函数中更改设置:

this.state = {
    series: [], 
    options: {
        // Your options
    }
};
然后使用以下命令在Axios调用中添加数据:

this.setState({series: data})

this.state={series:this.state={
这是打字错误吗?