jsxgraph - JSXGraph 将轴刻度更改为日期
解决方案
您可以“手动”插入刻度并将其标签设置为任意字符串。这是一个示例,请参见https://jsfiddle.net/8f65cgdq/7/:
// Initialize the board without axes
const board = JXG.JSXGraph.initBoard('jxgbox', {
boundingbox: [-1, 100, 10, -8], axis:false
});
// Add a vertical axis
board.create('axis',[[0, 0], [0, 10]]);
// Add a horizontal axis
var xaxis = board.create('axis',[[0,0], [1,0]]);
// Remove the default ticks
xaxis.removeTicks(xaxis.defaultTicks);
// Create your own ticks with non-standard labels
var ticks = board.create('ticks', [xaxis,
[2, 4, 6, 8]], {
labels: ['1.8.2019', '15.8.2019', '30.8.2019', '15.9.2019'],
strokeColor: '#00ff00',
majorHeight: -1,
drawLabels: true,
label: {offset: [0,-5], anchorX: 'middle', anchorY: 'top'}
});
推荐阅读
- android-studio - android studio windows 10中的zsh自动建议
- python - 如何迭代命名元组列表,按键值过滤和分组,然后处理输出
- flutter - 未能从 http.post [http: 499] 得到响应
- c# - 如何在 Unity 中保存玩家数据?
- javascript - 如何在 console.log 中打印 props 值?
- html - 我们可以通过选择父元素向子元素添加属性吗
- composer-php - 如何定位 TYPO3 二进制 (typo3)
- python - TaLib 检测到错误的锤形蜡烛?
- python - 在字符串中拆分以分号分隔的等号
- google-bigquery - 错误消息中引用了什么 BigQuery API 方法?