设置一个自定义范围选择器,并在图表和导航器上禁用xAxis标签

Set a custom rangeSelector and disable xAxis label on chart and on Navigator with Highstock

本文关键字:导航 标签 xAxis 一个 自定义 选择器 范围 设置      更新时间:2023-09-26

我使用hilitock和lazy-loading,就像在这个演示中,我使用两个不同的系列:都有一个"time"参数,但它们都不应该有一个日期-时间xAxis。

每个系列的结构如下:

serie1:[{"x" => 1, "y" => value_1, "time" => time_of_point_1},
        {"x" => 2, "y" => value_2, "time" => time_of_point_2},
        ....
        {"x" => n, "y" => value_n, "time" => time_of_point_n}];

serie2:[{"x" => 1, "y" => value_1, "z" => value_z_1, "time" => time_of_point_1},
        {"x" => 2, "y" => value_2, "z" => value_z_2, "time" => time_of_point_2},
        ....
        {"x" => n, "y" => value_n, "z" => value_z_n, "time" => time_of_point_n}];

我的目标是有一个自定义的rangeSelector,可以根据每个点的时间参数缩放图表。

我的问题是:

是可能有一个自定义的范围选择器缩放图表根据点参数不同于x和y值?:

假设:

 events:{
    if (e.trigger == "rangeSelectorButton" && 
        e.rangeSelectorButton.text == "last 3 hours"){
        // zoom on chart and set the chart
        // with all point that has "time" parameter 
        // between now and the last three hours
    }
}

我正在寻找一种方法来禁用X轴标签,使所有更可读

我试图禁用图表xAxis和导航器xAxis上的标签,但无论它每次显示什么。

我使用了以下代码:

xAxis : {
    label: {
       enabled: false
    }
}

但是它不工作。

有什么建议吗?

有两种方法:

  • 可以调用rangeselector,点击调用setExtremesrel主题
  • 准备你自己的html按钮并调用setextrees ()

在xAxis中应该是标签,而不是label:

xAxis : {
    labels: {
       enabled: false
    }
}