dimple.js如何在不更改数据的情况下更改图表轴的标签? [英] dimple.js How can I change the labels of a chart axis without changing the data?

查看:207
本文介绍了dimple.js如何在不更改数据的情况下更改图表轴的标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我们有示例的条形图 http://dimplejs.org/examples_viewer.html ?id = bars_vertical ,并且我想将x轴标签从Months更改为Meses。



若要这样做,只需指定标题属性:

  var chart = new dimple.chart(svg,data); 
var x = chart.addCategoryAxis(x,[Fruit,Year]);
x.title =我的新标题;


Say we have the bar chart of the example http://dimplejs.org/examples_viewer.html?id=bars_vertical and I want to change the x axis label from "Months" to "Meses". How can I do that?

解决方案

Instead of changing the titleShape after drawing, you can also change the title directly before drawing.

To do so, simply assign the title property:

var chart = new dimple.chart(svg, data);
var x = chart.addCategoryAxis("x", ["Fruit", "Year"]);
x.title = "My New Title";

这篇关于dimple.js如何在不更改数据的情况下更改图表轴的标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆