Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.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 堆栈条形图未更新highchart_Javascript_Angular_Typescript_Highcharts - Fatal编程技术网

Javascript 堆栈条形图未更新highchart

Javascript 堆栈条形图未更新highchart,javascript,angular,typescript,highcharts,Javascript,Angular,Typescript,Highcharts,我想完全更新堆栈条形图,但现在图表并没有完全更新,它只是将新数据添加到现有图表中。这是演示 您只是在更新苹果。按此格式添加其他水果 update() { this.drawChart( [ { name: "apple", data: [34, 56, 76, 99], color: "#236bb4", type: "bar&qu

我想完全更新堆栈条形图,但现在图表并没有完全更新,它只是将新数据添加到现有图表中。这是演示


您只是在更新苹果。按此格式添加其他水果

update() {
    this.drawChart(
      [
        {
          name: "apple",
          data: [34, 56, 76, 99],
          color: "#236bb4",
          type: "bar"
        },
        {
          name: "banana",
          data: [34, 56, 76, 99],
          color: "#ff6bc6",
          type: "bar"
        },
        {
          name: "mango",
          data: [34, 56, 76, 99],
          color: "#006bf1",
          type: "bar"
        }
      ],
      ["Mueed", "Ali", "Ahmed", "Amir"]
    );
  }
}

在使用highcharts角度包装器时,应通过更改
图表选项来更新图表

在下面的演示中,您可能会找到更新图表的推荐方法。
出于某种原因,销毁然后再次渲染非常重要时,请首先使用
destroy
方法,创建对该图表的引用
但在我看来,当你想将另一个数据放入图表(更新)时,没有必要使用它

API:

现场演示:

您的意思是更新每个用户的每个水果的数量吗?@AlbertoValerio,正如您在演示中所看到的,我想更新每个用户的每个水果的值,即单击要在图表上显示的所有苹果值的更新user@SebastianW伊泽尔,你能帮我吗,请这不是我想要的请进一步告诉我,我不理解你的问题@mueedullah在我的场景中,当我选择“apple”时,页面上有一些输入过滤器,所以只有我通过API收到的apple数据,因此,在应用过滤器后,我只想在图表上显示苹果条,但现在苹果值被添加到当前数据中,这是我不需要的。当您添加对图表的引用时,您可以使用
remove
series方法,然后代替该序列添加另一个。演示:API: