可能是重复,但尚未找到相关答案。
尝试根据日期显示数字数据。就像在这里找到的那样: https://www.highcharts.com/demo/line-time-series
这是我正在使用的数据(与他们的设置很接近或相同)
function InitiateGrid(e) {
var grid = e.detailRow.find(".entityDetail").kendoGrid({
dataSource: {
type: "json",
transport: {
read: function (option) {
$.ajax({
contentType: "json",
url: "/Test.svc/json/GetDetail",
success: function (result) {
option.success(result.Response); //error happening within this line of code
},
error: function (result) {
option.error(result.Response);
},
data: {
entityId: function () { return $("#txtEntityId").val(); },
entityTypeName: function () { return $("#txtEntityType").val(); }
}
});
}
},
schema: {
model: {
fields: {
Number: { type: "string", editable: false, nullable: true },
Id: { type: "string", editable: false },
}
}
},
},
scrollable: true,
sortable: true,
pageable: false,
selectable: "row",
columns: [
{
filterable: false,
title: "Number",
field: "Number",
width: 25,
},
{
filterable: false,
field: "Id",
title: "Id",
width: 25,
}
]
});
}
这是我的高级代码:
var data = [[Date.UTC(2016,10,07),0],[Date.UTC(2016,10,08),29.73],[Date.UTC(2016,10,09),29.68],[Date.UTC(2016,10,10),51.36],[Date.UTC(2016,10,11),35.95],[Date.UTC(2016,10,12),52.19],[Date.UTC(2016,10,13),60.73],[Date.UTC(2016,10,14),55.59],[Date.UTC(2016,10,15),76.78],[Date.UTC(2016,10,16),69.95],[Date.UTC(2016,10,17),66.94],[Date.UTC(2016,10,18),59.58],[Date.UTC(2016,10,19),66.38],[Date.UTC(2016,10,20),60.51],[Date.UTC(2016,10,21),59.66],[Date.UTC(2016,10,22),61.72],[Date.UTC(2016,10,23),64.42],[Date.UTC(2016,10,24),68.69],[Date.UTC(2016,10,25),62.46],[Date.UTC(2016,10,26),58.45],[Date.UTC(2016,10,27),59.5],[Date.UTC(2016,10,28),53.93],[Date.UTC(2016,10,29),63.62],[Date.UTC(2016,10,30),61.11],[Date.UTC(2016,10,31),75.21],[Date.UTC(2016,11,01),59.09],[Date.UTC(2016,11,02),69.21],[Date.UTC(2016,11,03),52.67],[Date.UTC(2016,11,04),56.61],[Date.UTC(2016,11,05),67.3],[Date.UTC(2016,11,06),56.44],[Date.UTC(2016,11,07),46.44],[Date.UTC(2016,11,08),47.95],[Date.UTC(2016,11,09),29.35],[Date.UTC(2016,11,10),51.37],[Date.UTC(2016,11,11),41.9],[Date.UTC(2016,11,12),68.12],[Date.UTC(2016,11,13),59.2],[Date.UTC(2016,11,14),50.87],[Date.UTC(2016,11,15),61.83],[Date.UTC(2016,11,16),51.01],[Date.UTC(2016,11,17),51.16],[Date.UTC(2016,11,18),43.28],[Date.UTC(2016,11,19),50.18],[Date.UTC(2016,11,20),51.73],[Date.UTC(2016,11,21),60.81],[Date.UTC(2016,11,22),56.51],[Date.UTC(2016,11,23),56.02],[Date.UTC(2016,11,24),58.86],[Date.UTC(2016,11,25),63.63],[Date.UTC(2016,11,26),56.77],[Date.UTC(2016,11,27),61.58],[Date.UTC(2016,11,28),59.42],[Date.UTC(2016,11,29),52.23],[Date.UTC(2016,11,30),46.75],[Date.UTC(2016,12,01),47.2],[Date.UTC(2016,12,02),42.88],[Date.UTC(2016,12,03),58.06],[Date.UTC(2016,12,04),52.24],[Date.UTC(2016,12,05),53.58],[Date.UTC(2016,12,06),55.04],[Date.UTC(2016,12,07),51.36],[Date.UTC(2016,12,08),57.56],[Date.UTC(2016,12,09),54.32],[Date.UTC(2016,12,10),66.92],[Date.UTC(2016,12,11),72.38],[Date.UTC(2016,12,12),50.62],[Date.UTC(2016,12,13),48.89],[Date.UTC(2016,12,14),53.18],[Date.UTC(2016,12,15),49.54],[Date.UTC(2016,12,16),44.06],[Date.UTC(2016,12,17),50.16],[Date.UTC(2016,12,18),40.01],[Date.UTC(2016,12,19),34.16],[Date.UTC(2016,12,20),43.78],[Date.UTC(2016,12,21),32.2],[Date.UTC(2016,12,22),27.27],[Date.UTC(2016,12,23),32.78],[Date.UTC(2016,12,24),32.38],[Date.UTC(2016,12,25),44.17],[Date.UTC(2016,12,26),39.34],[Date.UTC(2016,12,27),40.25],[Date.UTC(2016,12,28),39.28],[Date.UTC(2016,12,29),36.7],[Date.UTC(2016,12,30),36.28],[Date.UTC(2016,12,31),28.94],[Date.UTC(2017,01,01),31.49],[Date.UTC(2017,01,02),32.38],[Date.UTC(2017,01,03),30.88],[Date.UTC(2017,01,04),27.15],[Date.UTC(2017,01,05),29.91],[Date.UTC(2017,01,06),26.23],[Date.UTC(2017,01,07),29.94],[Date.UTC(2017,01,08),30.54],[Date.UTC(2017,01,09),27.64],[Date.UTC(2017,01,10),20.7],[Date.UTC(2017,01,11),18.77],[Date.UTC(2017,01,12),23.26],[Date.UTC(2017,01,13),22.99],[Date.UTC(2017,01,14),23.96],[Date.UTC(2017,01,15),26.21],[Date.UTC(2017,01,16),21],[Date.UTC(2017,01,17),18.34],[Date.UTC(2017,01,18),19.1],[Date.UTC(2017,01,19),23.43],[Date.UTC(2017,01,20),19.98],[Date.UTC(2017,01,21),29.78],[Date.UTC(2017,01,22),32.42],[Date.UTC(2017,01,23),23.55],[Date.UTC(2017,01,24),19.38],[Date.UTC(2017,01,25),24.19],[Date.UTC(2017,01,26),24.64],[Date.UTC(2017,01,27),23.37],[Date.UTC(2017,01,28),25.87],[Date.UTC(2017,01,29),27.14],[Date.UTC(2017,01,30),23.39],[Date.UTC(2017,01,31),23.01],[Date.UTC(2017,02,01),21.52],[Date.UTC(2017,02,02),21.23],[Date.UTC(2017,02,03),18.25],[Date.UTC(2017,02,04),25.6],[Date.UTC(2017,02,05),26.34],[Date.UTC(2017,02,06),22.73],[Date.UTC(2017,02,07),24.52],[Date.UTC(2017,02,08),24.53],[Date.UTC(2017,02,09),22.69],[Date.UTC(2017,02,10),23.15],[Date.UTC(2017,02,11),24.89],[Date.UTC(2017,02,12),25.57],[Date.UTC(2017,02,13),21.83],[Date.UTC(2017,02,14),22.05],[Date.UTC(2017,02,15),19.55],[Date.UTC(2017,02,16),21.63],[Date.UTC(2017,02,17),18.88],[Date.UTC(2017,02,18),19.52],[Date.UTC(2017,02,19),23.06],[Date.UTC(2017,02,20),20.8],[Date.UTC(2017,02,21),24.07],[Date.UTC(2017,02,22),28.69],[Date.UTC(2017,02,23),26.16],[Date.UTC(2017,02,24),28.72],[Date.UTC(2017,02,25),29.43],[Date.UTC(2017,02,26),31.02],[Date.UTC(2017,02,27),28.19],[Date.UTC(2017,02,28),27.27],[Date.UTC(2017,03,01),28.92],[Date.UTC(2017,03,02),30.27],[Date.UTC(2017,03,03),30.52],[Date.UTC(2017,03,04),32.42],[Date.UTC(2017,03,05),32.04],[Date.UTC(2017,03,06),26.58],[Date.UTC(2017,03,07),26.77],[Date.UTC(2017,03,08),28.76],[Date.UTC(2017,03,09),30.69],[Date.UTC(2017,03,10),27.19],[Date.UTC(2017,03,11),31.61],[Date.UTC(2017,03,12),36.33],[Date.UTC(2017,03,13),36.35],[Date.UTC(2017,03,14),33.62],[Date.UTC(2017,03,15),31.55],[Date.UTC(2017,03,16),29.87],[Date.UTC(2017,03,17),31.9],[Date.UTC(2017,03,18),31.78],[Date.UTC(2017,03,19),29.15],[Date.UTC(2017,03,20),31.87],[Date.UTC(2017,03,21),24.17],[Date.UTC(2017,03,22),21.23],[Date.UTC(2017,03,23),24.27],[Date.UTC(2017,03,24),25.47],[Date.UTC(2017,03,25),31.01],[Date.UTC(2017,03,26),28.05],[Date.UTC(2017,03,27),30.27],[Date.UTC(2017,03,28),25.61],[Date.UTC(2017,03,29),32.54],[Date.UTC(2017,03,30),21.63],[Date.UTC(2017,03,31),21.2],[Date.UTC(2017,04,01),35.94],[Date.UTC(2017,04,02),31.84],[Date.UTC(2017,04,03),30.24],[Date.UTC(2017,04,04),24.34],[Date.UTC(2017,04,05),22.79],[Date.UTC(2017,04,06),27.27],[Date.UTC(2017,04,07),27.83],[Date.UTC(2017,04,08),33.1],[Date.UTC(2017,04,09),38.99],[Date.UTC(2017,04,10),26.34],[Date.UTC(2017,04,11),37.35],[Date.UTC(2017,04,12),25.15],[Date.UTC(2017,04,13),29.44],[Date.UTC(2017,04,14),27.19],[Date.UTC(2017,04,15),26.78],[Date.UTC(2017,04,16),27.86],[Date.UTC(2017,04,17),23.04],[Date.UTC(2017,04,18),23.52],[Date.UTC(2017,04,19),23.62],[Date.UTC(2017,04,20),26.03],[Date.UTC(2017,04,21),22.71],[Date.UTC(2017,04,22),43.35],[Date.UTC(2017,04,23),35.57],[Date.UTC(2017,04,24),34.01],[Date.UTC(2017,04,25),33.23],[Date.UTC(2017,04,26),41.82],[Date.UTC(2017,04,27),34.89],[Date.UTC(2017,04,28),26.17],[Date.UTC(2017,04,29),16.48],[Date.UTC(2017,04,30),30.96],[Date.UTC(2017,05,01),12.55],[Date.UTC(2017,05,02),3.88],[Date.UTC(2017,05,03),18.59],[Date.UTC(2017,05,04),8.43],[Date.UTC(2017,05,05),29.24],[Date.UTC(2017,05,06),35.04],[Date.UTC(2017,05,07),45.75],[Date.UTC(2017,05,08),38.61],[Date.UTC(2017,05,09),35.24],[Date.UTC(2017,05,10),37],[Date.UTC(2017,05,11),37.97],[Date.UTC(2017,05,12),38.25],[Date.UTC(2017,05,13),44.95],[Date.UTC(2017,05,14),57.75],[Date.UTC(2017,05,15),40.68],[Date.UTC(2017,05,16),31.99],[Date.UTC(2017,05,17),41.98],[Date.UTC(2017,05,18),38.44],[Date.UTC(2017,05,19),36.08],[Date.UTC(2017,05,20),41.3],[Date.UTC(2017,05,21),51.74],[Date.UTC(2017,05,22),47.37],[Date.UTC(2017,05,23),42.44],[Date.UTC(2017,05,24),34.73],[Date.UTC(2017,05,25),35.1],[Date.UTC(2017,05,26),32.71],[Date.UTC(2017,05,27),29.83],[Date.UTC(2017,05,28),34.77],[Date.UTC(2017,05,29),31.7],[Date.UTC(2017,05,30),32.47],[Date.UTC(2017,05,31),30.32],[Date.UTC(2017,06,01),32.75],[Date.UTC(2017,06,02),32.13],[Date.UTC(2017,06,03),36.44],[Date.UTC(2017,06,04),30.93],[Date.UTC(2017,06,05),32.19],[Date.UTC(2017,06,06),28.82],[Date.UTC(2017,06,07),34.32],[Date.UTC(2017,06,08),32.52],[Date.UTC(2017,06,09),27.85],[Date.UTC(2017,06,10),35.98],[Date.UTC(2017,06,11),33.66],[Date.UTC(2017,06,12),33.84],[Date.UTC(2017,06,13),28.17],[Date.UTC(2017,06,14),24.51],[Date.UTC(2017,06,15),29.9],[Date.UTC(2017,06,16),26.79],[Date.UTC(2017,06,17),32.43],[Date.UTC(2017,06,18),31.39],[Date.UTC(2017,06,19),25.17],[Date.UTC(2017,06,20),33.94],[Date.UTC(2017,06,21),30.04],[Date.UTC(2017,06,22),32.2],[Date.UTC(2017,06,23),27.64],[Date.UTC(2017,06,24),30.91],[Date.UTC(2017,06,25),37.13],[Date.UTC(2017,06,26),38.73],[Date.UTC(2017,06,27),37.48],[Date.UTC(2017,06,28),37.68],[Date.UTC(2017,06,29),43.28],[Date.UTC(2017,06,30),39.79],[Date.UTC(2017,07,01),28.66],[Date.UTC(2017,07,02),23.25],[Date.UTC(2017,07,03),25.6],[Date.UTC(2017,07,04),23.57],[Date.UTC(2017,07,05),25.53],[Date.UTC(2017,07,06),27.49],[Date.UTC(2017,07,07),25.15],[Date.UTC(2017,07,08),22.37],[Date.UTC(2017,07,09),17.88],[Date.UTC(2017,07,10),24.04],[Date.UTC(2017,07,11),23.09],[Date.UTC(2017,07,12),22.72],[Date.UTC(2017,07,13),22.78],[Date.UTC(2017,07,14),21.02],[Date.UTC(2017,07,15),19.41],[Date.UTC(2017,07,16),23.84],[Date.UTC(2017,07,17),26.35],[Date.UTC(2017,07,18),23.51],[Date.UTC(2017,07,19),21.63],[Date.UTC(2017,07,20),22.87],[Date.UTC(2017,07,21),22.47],[Date.UTC(2017,07,22),22.82],[Date.UTC(2017,07,23),21.63],[Date.UTC(2017,07,24),23.84],[Date.UTC(2017,07,25),23.05],[Date.UTC(2017,07,26),23.79],[Date.UTC(2017,07,27),26.15],[Date.UTC(2017,07,28),25.02],[Date.UTC(2017,07,29),26.07],[Date.UTC(2017,07,30),25.34],[Date.UTC(2017,07,31),35.53],[Date.UTC(2017,08,01),25.05],[Date.UTC(2017,08,02),24.92],[Date.UTC(2017,08,03),24.6],[Date.UTC(2017,08,04),25.39],[Date.UTC(2017,08,05),28.68],[Date.UTC(2017,08,06),17.69],[Date.UTC(2017,08,07),19.73],[Date.UTC(2017,08,08),12.31],[Date.UTC(2017,08,09),22.24],[Date.UTC(2017,08,10),16.89],[Date.UTC(2017,08,11),17.2],[Date.UTC(2017,08,12),25.04],[Date.UTC(2017,08,13),21.38],[Date.UTC(2017,08,14),19.17],[Date.UTC(2017,08,15),19.67]];
收到错误; #15 https://www.highcharts.com/errors/15
但是,图表看起来不错,但日期不对齐。它抵消了一个月。
正如您在Highcharts.chart('container', {
chart: {
zoomType: 'x'
},
title: {
text: 'DFP Data'
},
subtitle: {
text: document.ontouchstart === undefined ?
'Click and drag in the plot area to zoom in' : 'Pinch the chart to zoom in'
},
xAxis: {
type: 'datetime'
},
yAxis: {
title: {
text: 'CPM'
}
},
legend: {
enabled: false
},
plotOptions: {
area: {
fillColor: {
linearGradient: {
x1: 0,
y1: 0,
x2: 0,
y2: 1
},
stops: [
[0, Highcharts.getOptions().colors[0]],
[1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
]
},
marker: {
radius: 2
},
lineWidth: 1,
states: {
hover: {
lineWidth: 1
}
},
threshold: null
}
},
series: [{
type: 'area',
name: 'CPM',
data: data
}
]
});
变量中看到的那样。我将从2016-10-07开始(图表显示2016-11-07),最后它将进入2017-09-15,当时数据仅转到2017-08-15。
看起来像一个简单的,因为它唯一的抵消,但最简单的解决方法是什么?