AmChart - 未定义addTitle

时间:2015-02-02 19:54:48

标签: javascript amcharts

我正在尝试使用AmCharts构建一些图表,我需要动态设置标题。根据文档,每个图表都应该有一个addTitle()方法:

http://docs.amcharts.com/3/javascriptcharts/AmChart

addTitle(text, size, color, alpha, bold)
text - text of a title size - font size color - title color alpha - title opacity bold - boolean value indicating if title should be bold.
Adds title to the top of the chart. Pie, Radar positions are updated so that they won't overlap. Plot area of Serial/XY chart is also updated unless autoMargins property is set to false. You can add any number of titles - each of them will be placed in a new line. To remove titles, simply clear titles array: chart.titles = []; and call chart.validateNow() method.

我看不到这样的方法。我正在使用AmCharts.makeChart()创建图表,传递div和图表定义对象:

var chart = AmCharts.makeChart($chartDiv[0], chartDefinition);

当我检查我的图表对象时,我可以看到我在chartDefinition中包含的标题数组,但是没有定义addTitle()方法。

1 个答案:

答案 0 :(得分:0)

由于我有权发表评论,我将此作为答案发布。

我做了JSFiddle并试图重现你的问题。正如你所看到的一切正常。 (即使只有addTitle中的一个参数)如果您的问题仍然存在,也许您可​​以发布您的代码?

相关问题