假设我们有示例http://dimplejs.org/examples_viewer.html?id=bars_vertical的条形图,我想将x轴标签从"Months"更改为"Meses".我怎样才能做到这一点?
绘制后,您可以访问标题对象并设置其文本,如下所示:
chart = new dimple.chart(svg, data);
x = chart.addCategoryAxis("x", ["Fruit", "Year"]);
chart.addMeasureAxis("y", "Value");
chart.addSeries(["Volume", "Year"], dimple.plot.bar);
chart.draw();
x.titleShape.text("My New Title");
Run Code Online (Sandbox Code Playgroud)
这是工作:http://jsfiddle.net/y3BVN/
您可以在绘图之前直接更改标题,而不是在绘图后更改titleShape .
为此,只需指定title属性:
var chart = new dimple.chart(svg, data);
var x = chart.addCategoryAxis("x", ["Fruit", "Year"]);
x.title = "My New Title";
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4445 次 |
最近记录: |