[英]Change datetime format of x-axis?
I have a TChart
with an area series. 我有一个带有区域系列的
TChart
。 The area Points are mapped to datetime values. 区域点映射到日期时间值。 How can I change the format of the date labels on the x-axis?
如何更改X轴上日期标签的格式?
This does not work: 这不起作用:
area.add(new DateTime(timestamp), value); // Date value!
...
chart.getAxes().getBottom().getLabels().setDateTimeFormat("MMM 'yy");
This gives me an IllegalArgumentException: 这给了我一个IllegalArgumentException:
new DateTime(2012,1,1).toString("MMM 'yy");
The comma ' in the string format argument is unnaccepted. 字符串格式参数中的逗号'不被接受。
As you can read here , the single quote is used to avoid interpretation. 如您在这里阅读的,单引号用于避免解释。 Put two single quotes to draw a single quote:
用两个单引号引起一个单引号:
new DateTime(2012,1,1).toString("MMM ''yy");
You need set the XValues of Area as DateTime as do in next line of code: 您需要像下一行代码一样将Area的XValues设置为DateTime:
area.getXvalues().setDateTime(true);
Please, try again if adding my line of code help you to solve your problem. 如果添加我的代码行可以帮助您解决问题,请重试。
I hope will helps. 希望会有所帮助。
Thanks, 谢谢,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.