微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用angular在amcharts4中未找到数据时如何显示“未找到记录”消息

如何解决使用angular在amcharts4中未找到数据时如何显示“未找到记录”消息

我们将 amcharts4 lib 用于在 angular 8 中使用的图表,但我找不到有关如何显示类似“未找到数据”等消息的文档

ngAfterViewInit() {
    this.zone.runOutsideAngular(() => {
      let chart = am4core.create(this.chartDom.nativeElement,am4charts.XYChart);
      this.chart = chart;
      this.setBarchart();
    });
  }
 

private setBarChart() {
       let categoryAxis = barChart.xAxes.push(new am4charts.CategoryAxis());
       categoryAxis.datafields.category = this.mappingKeys.x;
        categoryAxis.renderer.grid.template.strokeWidth = 0;
        categoryAxis.fontSize = 11;    //Vertical axis
        let valueAxis = barChart.yAxes.push(new am4charts.ValueAxis());
        valueAxis.renderer.minGriddistance = 30;
        valueAxis.title.text = this.titleXkeyTranslate;

      // mapping the data to preview in charts
        barChart.data = this.inputFromParent.data; 
    }

当 this.inputFromParent.data.length = 0 即没有数据时,我想显示一条消息,我们该怎么做,请帮忙

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。