- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要构建一个图表来按地区显示世界的人口,示例数据是
China 1,361,300,000
India 1,236,970,000
United States 317,148,000
Indonesia 237,641,326
Brazil 201,032,714
我是 Dygraphs
的新手,我尝试了同样的简单示例:
<html>
<head>
<script type="text/javascript"
src="http://dygraphs.com/dygraph-combined.js"></script>
</head>
<body>
<div id="demodiv" style="width:500px;height:500px"></div>
<script type="text/javascript">
var data = "Country,Population\n" +
"1,1361300000\n" +
"2,1236970000\n" +
"3,317148000\n" +
"4,237641326\n" +
"5,201032714\n";
g = new Dygraph(document.getElementById("demodiv"), data, {
title: "World's Population"
});
</script>
</body>
</html>
现在,如何使用 Dygraphs
在 x 轴
上显示国家名称而不是数字? Dygraphs
是否可行?
提前致谢。
最佳答案
您可以使用 valueFormatter 和 axisLabelFormatter 选项。参见 http://dygraphs.com/options.html
以下示例将打印图例内的“文本:”和数据中的 x 值。
axes: {
x: {
valueFormatter: function(x) {
return 'text';
},
axisLabelFormatter: function(x) {
return x;
},
}
},
jsfiddle 中的示例:http://jsfiddle.net/JaM3S/
关于axis-labels - 在 Dygraphs 中,如何将 AxisLabels 显示为文本而不是数字/日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20234787/
投入大量时间后,我不知道自己错过了什么。我遵循了许多与自定义标签相关的示例,但我找不到答案。可能出什么问题了?非常感谢您的帮助。 自定义标签定义: NSMutableArray *customArra
我无法将轴格式化为货币,知道吗? 我究竟做错了什么?我需要能够即时更改格式,对于此测试,我想将其设置为值刻度上 Y 轴的货币。 任何人? 谢谢... var columnSeries = ne
实际上我想获取 xAxis label 的字符串值。如何得到它?我有 xAxis 标签数组: let xAxis = axisSet.xAxis as CPTXYAxis! let l
我正在使用带有插件“jquery.flot.axislabels.js”的 flot,但我找不到除自述文件之外的其他文档。 所以一般的问题是“我在哪里可以找到一些完整的文档?” 更具体的一个是:“如何
有没有办法在红线中添加边距空间?我想在轴标签和标题之间添加边距空间。 实时图表:https://lvcharts.net/ 最佳答案 我认为不可能通过设置属性来实现。但作为一个肮脏的 hack,您可以
我需要构建一个图表来按地区显示世界的人口,示例数据是 China 1,361,300,000 India 1,236,970,000 United States
我正在尝试将井号添加到 NVD3 轴标签。 以下 不起作用有效: chart.yAxis.axisLabel('£') 这不是 chart.yAxis.axisLabel('£') 不确定
我是一名优秀的程序员,十分优秀!