如何动态地添加和删除角度10中的highchart? [英] How to dynamiccally add and remove highchart in angular 10?

查看:256
本文介绍了如何动态地添加和删除角度10中的highchart?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

删除图表后,我需要不显示任何数据图像,

I need to show NO data image when chart is removed,,

我无法添加/删除高度图

I am unable to add/ remove the highchart

我这样尝试过 https://stackblitz.com/编辑/highcharts-angular-demo-h1cm75?file=src%2Fapp%2Fapp.component.ts

任何人都可以帮助我

推荐答案

您可以使用称为no-data-to-display的Highcharts模块,因为使用innerHTML / outerHTML并不是很安全,因为它不是很安全的.
我在Angular中重新创建了它,类似于您在API中看到的(我使用了一个稍微简单的示例,因为您有更多的Thins,并且看到它们之间的差异可能很困难).

You can use the Highcharts module called no-data-to-display because using innerHTML / outerHTML is not ideal because it's not pertuculary safe.
I recreated it in Angular similarly to what you might see in the API (I used a slightly simpler example since your has additional thins and seeing the difference might be difficult).

首先,我导入了模块,并使用Highcharts对其进行了初始化.然后,我使用了推荐的更新数据的方法.
当数据数组为空时,Highcharts会处理该问题并显示一条消息,提示没有数据.您可以自定义该消息-请参阅API.

First I imported the module and initialized it with the Highcharts. Then I used the recommended way of updating the data.
When the data array is empty, Highcharts handles that and show a message that there is no data. You might customize that mesage- see the API.

API:: https://api.highcharts.com/highcharts/noData
演示: https://stackblitz.com /edit/highcharts-angular-no-data-to-display

这篇关于如何动态地添加和删除角度10中的highchart?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆