代码之家  ›  专栏  ›  技术社区  ›  camden_kid

AmCharts 4-如何在使用API时设置导出的名称?

  •  2
  • camden_kid  · 技术社区  · 6 年前

    this.config = {};
    this.chartId = 'myId';
    this.chartType = am4charts.PieChart;
    
    this.chart = am4core.createFromConfig(
      {
        this.config,
        this.chartId,
        this.chartType
      }
    );
    

    然后做:

    this.chart.exporting.export('png');
    

    导出文件的名称默认设置为“amCharts.png". 如何将名称设置为其他名称?

    this.config = { export: { fileName: 'yay' } };
    this.config = { fileName: 'yay' };
    
    1 回复  |  直到 6 年前
        1
  •  2
  •   camden_kid    6 年前

    好吧,其实很简单:

    this.chart.exporting.filePrefix = 'yay;
    this.chart.exporting.export('png');