如何使用vue-highcharts全局设置Highcharts对象配置?

卢比亚娜·姆贝巴蒂(Lupyana Mbembati)

我想知道是否有一种方法可以在Vue应用程序中为高图表全局设置图表选项。我使用以下插件安装:

import Vue from "vue";
import Highcharts from "highcharts";
import VueHighcharts from "vue-highcharts";
import addFunnelModule from "highcharts/modules/funnel";
import exporting from "highcharts/modules/exporting";
import offlineExporting from "highcharts/modules/offline-exporting";

exporting(Highcharts);
offlineExporting(Highcharts);
addFunnelModule(Highcharts);
Vue.use(VueHighcharts, { Highcharts });

我想设置导出图表的选项,以便它们适用于所有图表。

卢比亚娜·姆贝巴蒂(Lupyana Mbembati)

我已经知道了。为此,您可以在其中使用setOptions函数,并传递要全局设置的所有属性。

import Vue from "vue";
import Highcharts from "highcharts";
import VueHighcharts from "vue-highcharts";
import exporting from "highcharts/modules/exporting";
import offlineexporting from "highcharts/modules/offline-exporting";

exporting(Highcharts);
offlineexporting(Highcharts);
Highcharts.setOptions({
  credits: {
    text: "some test",
    href: "http://destinationlink",
    style: {
      color: "black",
    },
    position: {
      align: "right",
    },
  },
});
Vue.use(VueHighcharts, { Highcharts });

有关选项的完整列表,请参阅docs

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章