highcharts - Highcharts 多个 rowsUrl 在同一个图表中
问题描述
如何使用 rowsUrl 显示多个系列?
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>
解决方案
使用seriesMapping
属性:
data: {
...,
seriesMapping: [{
x: 0,
y: 1
}, {
x: 0,
y: 2
}]
}
现场演示:https ://jsfiddle.net/BlackLabel/k8gt2vLp/
API:https ://api.highcharts.com/highcharts/data.seriesMapping
推荐阅读
- sql - 将查询结果与表进行比较并检索特定字段
- php - $loader = new loader($registry) classloader' not found in
- json - Ansible RAW 模块 - Curl 和 JSON 文件 (Kubernetes)
- javascript - javascript:history.go(-1) 不适用于 IE 和 Chrome
- r - 如何按因子级别将具有多个参数的自定义函数应用于 df
- shell - 如果它们是来自 git 或 bitbuket 中特定文件或文件夹的任何未决更改,则需要编写脚本,不应触发团队城市构建
- java - 在具有多个线程的图像上应用中值
- cordova - Ionic 3 Cordova onclick 事件
- django-rest-framework - 文档中的查询参数未显示带有过滤器的视图
- ruby-on-rails - 无法区分 rails admin 中的 new 和 edit 操作