一页上有10个图形。我想在新页面中显示这些页面上的数据。我使export-csv.js插入。我做了补充;
$(function () {
Highcharts.chart('gool', {
chart: {
zoomType: 'xy'
},
title: {
id: '101',
text: 'Soccer Gool'
`Highcharts.Chart.prototype.downloadItem = function(){
var url = this.title.textStr.replace(/ /g, '-').toLowerCase();
var url = this.title.id;
var left = (screen.width/2)-(750/2);
var top = (screen.height/2)-(600/2);
return window.open('itemExport.jsp?Id='+url+asd, 'Export', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+900+', height='+600+', top='+top+', left='+left);
};
// Add "Download CSV" to the exporting menu. Use download attribute if supported, else
// run a simple PHP script that returns a file. The source code for the PHP script can be viewed at
// https://raw.github.com/highslide-software/highcharts.com/master/studies/csv-export/csv.php
if (Highcharts.getOptions().exporting) {
Highcharts.getOptions().exporting.buttons.contextButton.menuItems.push({
textKey: 'downloadCSV',
onclick: function () { this.downloadCSV(); }
}, {
textKey: 'downloadXLS',
onclick: function () { this.downloadXLS(); }
},{
textKey: 'downloadItem',
onclick: function () { this.downloadItem(); }
});
}
` 我无法获取id变量。我应该怎样做才能让代码工作?
答案 0 :(得分:0)
如果您对元素使用自定义属性,则可以通过chart.options
访问它。在您的情况下,它将是this.options.title.id
。