在HighStock图表的导航器中显示多个系列

时间:2013-01-30 13:05:42

标签: javascript highcharts highstock

我想创建一个HighStock图表,其中包含一个显示多个系列的导航器组件,与主图中显示的系列相同。 HighStock中似乎不支持此功能,因为只允许使用一个系列。有没有人遇到这个问题,并设法找到一个可行的解决方案/替代方案?

2 个答案:

答案 0 :(得分:9)

导航器中的多个系列不受官方支持,因此只有您使用的“hack”才会在导航器中显示多个系列。示例:http://jsfiddle.net/6fFwM/此功能在我们的系统中被请求(http://highcharts.uservoice.com/forums/55896-general/suggestions/2361925-allow-navigator-to-have-multiple-data-series),因此您可以对其进行投票。

window.chart.addSeries({
        name : "",
        xAxis: 0,
        yAxis: 1,
        type: "line",
        enableMouseTracking: false,
        data : new_data,
        showInLegend:false
});

答案 1 :(得分:5)

从Highstock 5开始,现在正式支持。您可以全局或专门为每个系列指定showInNavigator: trueAPI)。相关选项为navigatorOptionsAPI),这会影响showInNavigator设置为true的系列。

例如:(JSFiddle):

plotOptions: {
    series: {
        showInNavigator: true // Global value
    }
},

series: [{ // This series has no value set and will use global
    name: 'MSFT',
    data: MSFT
},
{
    name: 'GOOGL',
    showInNavigator: false, // Individual series value
    data: GOOGL
},
{
    name: 'ADBE',
    showInNavigator: true, // Individual series value
    navigatorOptions: { // Specific values that affect the series in the navigator only
        type: 'line',
        color: 'red'
    },
    data: ADBE
}]