我使用此图表显示我以这种格式通过RestService获取的数据:
"jsonData": [
{
"Resource": "ABC",
"TimeStamp": "23-07-2017",
"StatusPercentage": 100
},
{
"Resource": "PQR",
"TimeStamp": "23-07-2017",
"StatusPercentage": 100
},
{
"Resource": "XYZ",
"TimeStamp": "23-07-2017",
"StatusPercentage": 50
},
{
"Resource": "ABC",
"TimeStamp": "24-07-2017",
"StatusPercentage": 100
},
{
"Resource": "PQR",
"TimeStamp": "24-07-2017",
"StatusPercentage": 50
},
{
"Resource": "XYZ",
"TimeStamp": "24-07-2017",
"StatusPercentage": 100
}]
我将以下内容转换为highcharts的格式: 类别:[23-07-2017,24-07-2017] 系列:[{name:ABC,data:[100,100]},{name:PQR,data:[100,50]},{name:XYZ,data:[50,100]}]
Highcharts.chart('container', {
title: {
text: 'Solar Employment Growth by Sector, 2010-2016'
},
subtitle: {
text: 'Source: thesolarfoundation.com'
},
yAxis: {
title: {
text: 'Number of Employees'
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle'
},
plotOptions: {
series: {
pointStart: 2017
}
},
series: series: [ {
name: 'ABC',
data: [100,50,70],
timestamp: '23-07-2017'
}, {
name: 'XYZ',
data: [50,100,100],
timestamp: '24-07-2017'
}]
});
如何在这个JS小提琴中将我的开始点设置为特定日期或特定月份或特定年份:http://jsfiddle.net/bfhu7suv/ 像Pointstart:June或Pointstart:Friday或Pointstart:2017年7月23日
答案 0 :(得分:0)
添加:
xAxis: {
type: 'datetime'
},
系列你可以写成:
series: [{
name: 'Project Development',
data: [
null,
null,
[Date.UTC(2013, 5, 3), 12169],
[Date.UTC(2013, 5, 4), 11269]
]
}, {
name: 'Other',
data: [
[Date.UTC(2013, 5, 1), 12908],
[Date.UTC(2013, 5, 2), 12908],
[Date.UTC(2013, 5, 3), 2908],
[Date.UTC(2013, 5, 4), 2208]
]
}]
和PlotOptions的起始点为:
plotOptions: {
series: {
pointStart: Date.UTC(2013, 4, 30)
}
},
演示 Fiddle