【问题标题】:Highcharts stock chart time selectorHighcharts 股票图表时间选择器
【发布时间】:2016-06-14 01:06:42
【问题描述】:

我正在使用 highcharts 股票图表 similar to this。我的图表有数百个数据点。有没有办法以编程方式预先设置图表下方的时间滑块?

假设我的 X 轴有 100 个数据点(日期时间,按秒分组)。我希望图表的默认视图让选择器显示 20 个点。 40-60分

这是我正在使用的示例:

$(function () {
    $('#container').highcharts('StockChart', {

        rangeSelector: {
            buttonTheme: { // styles for the buttons
                fill: 'none',
                stroke: 'none',
                'stroke-width': 0,
                r: 8,
                style: {
                    color: '#039',
                    fontWeight: 'bold'
                },
                states: {
                    hover: {
                    },
                    select: {
                        fill: '#039',
                        style: {
                            color: 'white'
                        }
                    }
                    // disabled: { ... }
                }
            },
            inputBoxBorderColor: 'gray',
            inputBoxWidth: 120,
            inputBoxHeight: 18,
            inputStyle: {
                color: '#039',
                fontWeight: 'bold'
            },
            labelStyle: {
                color: 'silver',
                fontWeight: 'bold'
            },
            selected: 1
        },

        series: [{
            name: 'USD to EUR',
            data: usdeur
        }]
    });
});

【问题讨论】:

  • 我的回答解决了你的问题吗?

标签: javascript jquery charts highcharts


【解决方案1】:

在这个example 中,StockChart 用 300 个点绘制。接下来将检索点[40]和[60]的时间戳,并调用setExtremes()来设置底部导航器的最小和最大时间戳。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-29
    • 2011-05-26
    相关资源
    最近更新 更多