[英]Highcharts Export Server - Getting a blank chart
我正在開發一個使用Highcharts的應用程序。 在某些時候,我想導出圖表並獲取PNG網址。
為此,我嘗試使用Highcharts的導出服務器,它向我返回一個URL,但是當我嘗試瀏覽它時,卻得到一個空圖表。
var data = {
options: JSON.stringify(chart.options),
filename: chart.exporting.filename,
type: 'image/png',
async: true
};
var exportUrl = 'http://export.highcharts.com';
$.post(exportUrl, data, function(data){
var url = exportUrl + data;
};
這是我嘗試發送到導出服務器的chart.options
。 (另請參閱我的圖表的屏幕截圖,不知道是否可以使它更清晰)
{…}
chart: Object { styledMode: false, borderRadius: 0, colorCount: 10, … }
colors: Array(10) [ "#7cb5ec", "#434348", "#90ed7d", … ]
credits: Object { enabled: true, href: "https://www.highcharts.com?credits", text: "Highcharts.com", … }
exporting: Object { type: "image/png", url: "https://export.highcharts.com/", printMaxWidth: 780, … }
global: Object { }
labels: Object { style: {…} }
lang: Object { loading: "Loading...", decimalPoint: ".", resetZoom: "Reset zoom", … }
legend: Object { enabled: true, align: "right", alignColumns: true, … }
loading: Object { labelStyle: {…}, style: {…} }
navigation: Object { buttonOptions: {…}, menuStyle: {…}, menuItemStyle: {…}, … }
plotOptions: Object { line: {…}, area: {…}, spline: {…}, … }
responsive: Object { rules: (1) […] }
series: undefined
subtitle: Object { style: {…}, align: "center", widthAdjust: -44, … }
symbols: Array(5) [ "circle", "diamond", "square", … ]
time: Object { }
title: Object { align: "center", margin: 15, widthAdjust: -44, … }
tooltip: Object { enabled: true, animation: true, borderRadius: 3, … }
xAxis: Array [ {…} ]
yAxis: Array(14) [ {…}, {…}, {…}, … ]
<prototype>: Object { … }
4:1082:11
我期望變量“ url”可以顯示圖表,但這是一個空白圖表。 (我一直在遵循此處提供的第二種方法https://gist.github.com/philfreo/0a4d899de4257e08a000 )。 我以為錯誤可能來自“選項”部分,但我不知道該放什么。
代替chart.options
您應該使用chart.userOptions
。 檢查它,讓我知道它是否對您有幫助。
var data = {
options: JSON.stringify(chart.userOptions),
filename: chart.exporting.filename,
type: 'image/png',
async: true
};
var exportUrl = 'http://export.highcharts.com';
$.post(exportUrl, data, function(data){
var url = exportUrl + data;
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.