gpt4 book ai didi

javascript - 如何获取 Jquery 库中的特定属性?

转载 作者:行者123 更新时间:2023-11-28 15:39:32 25 4
gpt4 key购买 nike

各位,我在 Jquery 自定义库中编写了以下代码,用于在 ASP.net MVC 应用程序中绘制图表。现在我想使用 ajax 调用更改其中的特定值。请看一下我的代码:

来自 Jquery 自定义库:

 $('#performance-cart').highcharts({
chart: {
type: 'area', backgroundColor: '#f5f7f7', style: { fontFamily: 'Roboto, Sans-serif', color: '#aeafb1' },
animation: {
duration: 1500,
easing: 'easeOutBounce'
}
},
xAxis: {
type: 'datetime',
labels: { style: { color: '#aeafb1' } }
},
yAxis: {
min: 0, max: 50, tickInterval: 10, gridLineColor: '#ebeded', gridLineWidth: 1,
title: { text: '' }, lineWidth: 0, labels: { align: 'right', style: { color: '#aeafb1' } }
},
title: { text: '' },
tooltip: {
useHTML: true, headerFormat: '<h3 style="color:#ffffff;font-weight:300;padding: 3px 12px;">{point.y:,.1f}</br>',
backgroundColor: '#515757', pointFormat: 'Issues</h3>'//$('#performanceColumnChart').data('tooltip')
},
legend: {
itemStyle: { color: '#838589' }, symbolWidth: 12, symbolHeight: 5, itemWidth: 80, symbolRadius: 0,
itemMarginBottom: 10, backgroundColor: '#f5f7f7', verticalAlign: 'top', borderWidth: 0, x: -498, y: 10
},
plotOptions: {
area: {
fillOpacity: 0.2, cursor: 'pointer', marker: {
symbol: 'circle', fillColor: '#FFFFFF', lineWidth: 2, lineColor: null,
allowPointSelect: true
}
},
line: {
fillOpacity: 0.2, cursor: 'pointer', marker: {
symbol: 'circle', fillColor: '#FFFFFF', lineWidth: 2, lineColor: null,
allowPointSelect: true
}
},
column: {
fillOpacity: 0.2, cursor: 'pointer', marker: {
symbol: 'circle', fillColor: '#FFFFFF', lineWidth: 2, lineColor: null,
allowPointSelect: true
}
},
series: {
pointStart: myIssueResolvedStartDate,
pointInterval: 24 * 3600 * 1000 // one day
}
},
series: [{
name: 'Issues', color: '#ff3806',
data: myIssueData,
marker: { states: { hover: { fillColor: '#ff3806', lineColor: '#ffffff', lineWidth: 2 } } }
}, {
name: 'Resolved', color: '#1da9dd',
data: myResolvedData,
marker: { states: { hover: { fillColor: '#1da9dd', lineColor: '#ffffff', lineWidth: 2 } } }
}]
});

我的 Ajax 调用:

$.ajax(
{
type: "GET",
url: WebApiURL + "/api/home/GetQueryIssueResolvedData?deptCode=" + departCode,
dataType: "json",
crossDomain: true,
async: true,
cache: false,
success: function (myData) {
var chart = $('#performance-cart').highcharts();
var ResolvedStartDate = myData.data.IssueResolvedStartDate;
var issueData = myData.data.IssueData;
var resolveData = myData.data.ResolvedData;

//chart.plotOptions.series.setpointStart(ResolvedStartDate, true);
chart.series[1].setData(issueData, true);
chart.series[0].setData(resolveData, true);
},
error: function (x, e) {
alert('There seems to be some problem while fetching records!');
}

}
);

现在我想通过ajax调用替换jquery库的pointStart元素中的日期值,但我不知道如何获取该属性。

我尝试使用chart.plotOptions.series.setpointStart(ResolvedStartDate, true);但它说plotOptions未定义。如何让 pointStartResolvedStartDate 获取日期值?

最佳答案

您可以尝试使用单个系列的新选项来更新该系列 - 请参阅 http://api.highcharts.com/highcharts#Series.update

关于javascript - 如何获取 Jquery 库中的特定属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24302706/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com