javascript - Highcharts:带秒、分、小时和天的对数 y 轴

标签 javascript highcharts logarithm

我想在 y-axis 上显示时间值的数据Highchart 的图表。这些时间值可以从 10 秒到 10 天不等

目前我可以像这样设置y轴类型:

yAxis: {
  type: 'logarithmic'
}

然后得到像这样的东西:

y-axis scale with just minutes

使用对数时间刻度的最佳方式是什么,而不是只显示分钟,显示秒、分钟、小时和天

类似于:10 秒、30 秒、1 分钟、2 分钟、5 分钟、10 分钟、30 分钟、1 小时、2 小时、4 小时、8 小时、1 天、2 天、5 天、10 天.我知道这不完全是对数级数,但您希望能理解我的意思。

最佳答案

请引用我在该主题中的第一篇帖子(官方 Highcharts 论坛):https://forum.highcharts.com/highstock-usage/chart-customisation-t39677/?hilit=logarithmic#p137385

我在那里解释了如何连接对数轴和日期时间输入。

我简化了原来的demo,并根据您的需要进行了调整:http://jsfiddle.net/kkulig/5Ldowjbr/

在这种情况下,x 轴是对数的(不是 y):

  yAxis: [{
    type: 'logarithmic',
    showFirstLabel: false,
    labels: {
      formatter: function() {
        return Highcharts.dateFormat("%Hh %Mm %Ss", this.value + baseline - timeOffset);
      }
    }
  }],

我还将日期的显示格式更改为 %Hh %Mm %Ss 并将点的 timestamp 属性重命名为 miliseconds

关于javascript - Highcharts:带秒、分、小时和天的对数 y 轴,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48099189/

相关文章:

javascript - 在 HighCharts 中获取 X 轴值

WPF 和 Oxyplot : graph with CategoryAxis and LogarithmicAxis

javascript - 关于HTTP文件上传的2个问题

javascript - Google OpenID - 如何在 javascript 中使用 checkid_immediate?

json - Highcharts phantomjs 导出服务器无法解析 json 字符串

javascript - 在(highcharts)气泡图上显示百分比值

python log2 超过列表列表的索引

python - 用 Python 计算对数

javascript - 如何将一个文本区域拆分为两个文本区域?

javascript - 如何在单击时调用自定义元素成员方法?