在同一图表中Highcharts multiple rowsUrl

问题描述 投票:0回答:1

如何使用rowsUrl显示多个系列?

示例小提琴:https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/data/livedata-rows

Highcharts.chart('container', {
  chart: {
    type: 'spline'
  },
  title: {
    text: 'Live Data (Rows JSON)'
  },

  subtitle: {
    text: 'Data input from a remote JSON file'
  },

  data: {
    rowsURL: 'https://demo-live-data.highcharts.com/time-rows.json',
    firstRowAsNames: false,
    enablePolling: true
  }
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
highcharts
1个回答
0
投票

使用seriesMapping属性:

data: {
    ...,
    seriesMapping: [{
        x: 0,
        y: 1
    }, {
        x: 0,
        y: 2
    }]
}

现场演示:https://jsfiddle.net/BlackLabel/k8gt2vLp/

API:https://api.highcharts.com/highcharts/data.seriesMapping

© www.soinside.com 2019 - 2024. All rights reserved.