1

我已经使用 HighCharts 多年了,而且出乎意料地,将图表导出为 PNG、JPG 等不再起作用。我使用 cURL 以我应该的方式导出到http://export.highcharts.com/ :

curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

其中 $fields_string 的格式也很好,并且包括 svg= 参数。

为什么它一直给我返回错误:“manadatory svg POST parameter is undefined.”????

我已经尝试了各种方法,但为什么它不再起作用了?我在 HighCharts 网站上查看,但那里......他们确实有效。

var_dump() $fields_string 是:

string(7069) "svg=<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" version="1.1" width="700" height="422"><defs><clipPath id="highcharts-5"><rect rx="0" ry="0" fill="none" x="0" y="0" width="632" height="275" stroke-width="0.000001"></rect></clipPath></defs><rect rx="5" ry="5" fill="#FFFFFF" x="0" y="0" width="700" height="422" stroke-width="0.000001" stroke="#4572A7"></rect><text x="350" y="25" style="font-family:verdana, arial, helvetica, sans-serif;font-size:16px;color:#3e576f;fill:#3e576f;" text-anchor="middle" class="highcharts-title" ><tspan x="350">Test</tspan></text><g class="highcharts-grid" ></g><g class="highcharts-grid" ><path d="M 58 330.5 L 690 330.5" fill="none" stroke="#C0C0C0" stroke-width="1" ></path><path d="M 58 239.5 L 690 239.5" fill="none" stroke="#C0C0C0" stroke-width="1" ></path><path d="M 58 147.5 L 690 147.5" fill="none" stroke="#C0C0C0" stroke-width="1" ></path><path d="M 58 55.5 L 690 55.5" fill="none" stroke="#C0C0C0" stroke-width="1" ></path></g><g class="highcharts-series-group" ><g class="highcharts-series" clip-path="url(#highcharts-5)" visibility="visible" transform="translate(58,55)"><rect rx="0" ry="0" fill="none" x="82.5" y="16.5" width="149" height="257" stroke-width="5" stroke="rgb(0, 0, 0)" r="0" stroke-opacity="0.05" transform="translate(1,1)"></rect><rect rx="0" ry="0" fill="none" x="82.5" y="16.5" width="149" height="257" stroke-width="3" stroke="rgb(0, 0, 0)" r="0" stroke-opacity="0.1" transform="translate(1,1)"></rect><rect rx="0" ry="0" fill="none" x="82.5" y="16.5" width="149" height="257" stroke-width="1" stroke="rgb(0, 0, 0)" r="0" stroke-opacity="0.15000000000000002" transform="translate(1,1)"></rect><rect rx="0" ry="0" fill="#4572a7" x="82.5" y="16.5" width="149" height="257" stroke-width="1" stroke="#FFFFFF" r="0"></rect><rect rx="0" ry="0" fill="none" x="398.5" y="75.5" width="149" height="198" stroke-width="5" stroke="rgb(0, 0, 0)" r="0" stroke-opacity="0.05" transform="translate(1,1)"></rect><rect rx="0" ry="0" fill="none" x="398.5" y="75.5" width="149" height="198" stroke-width="3" stroke="rgb(0, 0, 0)" r="0" stroke-opacity="0.1" transform="translate(1,1)"></rect><rect rx="0" ry="0" fill="none" x="398.5" y="75.5" width="149" height="198" stroke-width="1" stroke="rgb(0, 0, 0)" r="0" stroke-opacity="0.15000000000000002" transform="translate(1,1)"></rect><rect rx="0" ry="0" fill="#aa4643" x="398.5" y="75.5" width="149" height="198" stroke-width="1" stroke="#FFFFFF" r="0"></rect></g></g><g class="highcharts-data-labels" visibility="visible" transform="translate(58,55)"><text x="158" y="10" style="font-family:verdana, arial, helvetica, sans-serif;font-size:11px;color:#4572a7;line-height:14px;font-weight:bold;fill:#4572a7;" text-anchor="middle" ><tspan x="158">56.42%</tspan></text><text x="474" y="69" style="font-family:verdana, arial, helvetica, sans-serif;font-size:11px;color:#4572a7;line-height:14px;font-weight:bold;fill:#4572a7;" text-anchor="middle" ><tspan x="474">43.58%</tspan></text></g><g class="highcharts-legend" transform="translate(274,381)"><rect rx="5" ry="5" fill="none" x="0.5" y="0.5" width="151" height="25" stroke-width="1" stroke="#909090" visibility="visible"></rect><text x="30" y="18" style="font-family:verdana, arial, helvetica, sans-serif;font-size:12px;cursor:pointer;color:#3e576f;fill:#3e576f;" ><tspan x="30">Performance Ratio</tspan></text><rect rx="2" ry="2" fill="#4572a7" x="9.5" y="7.5" width="16" height="12" stroke-width="1" stroke="#FFFFFF" r="0"></rect></g><g class="highcharts-axis" ><text x="216" y="344.19704790557563" style="font-family:verdana, arial, helvetica, sans-serif;font-size:11px;color:#666;line-height:14px;font:normal 9px sans-serif;fill:#666;" text-anchor="end" transform="rotate(-35 216 344)"><tspan x="216">Piano</tspan></text><text x="532" y="344.19704790557563" style="font-family:verdana, arial, helvetica, sans-serif;font-size:11px;color:#666;line-height:14px;font:normal 9px sans-serif;fill:#666;" text-anchor="end" transform="rotate(-35 532 344)"><tspan x="532">MagneticOne</tspan></text><path d="M 374.5 330.19704790557563 L 374.5 335.19704790557563" fill="none" stroke="#C0D0E0" stroke-width="1"></path><path d="M 690.5 330.19704790557563 L 690.5 335.19704790557563" fill="none" stroke="#C0D0E0" stroke-width="1"></path></g><g class="highcharts-axis" ><text x="50" y="335.29704790557565" style="font-family:verdana, arial, helvetica, sans-serif;font-size:11px;width:296px;color:#666;line-height:14px;fill:#666;" text-anchor="end"><tspan x="50">0</tspan></text><text x="50" y="243.630381238909" style="font-family:verdana, arial, helvetica, sans-serif;font-size:11px;width:296px;color:#666;line-height:14px;fill:#666;" text-anchor="end"><tspan x="50">20</tspan></text><text x="50" y="151.9637145722423" style="font-family:verdana, arial, helvetica, sans-serif;font-size:11px;width:296px;color:#666;line-height:14px;fill:#666;" text-anchor="end"><tspan x="50">40</tspan></text><text x="50" y="60.29704790557562" style="font-family:verdana, arial, helvetica, sans-serif;font-size:11px;width:296px;color:#666;line-height:14px;fill:#666;" text-anchor="end"><tspan x="50">60</tspan></text></g><text x="26" y="192.5" style="font-family:verdana, arial, helvetica, sans-serif;font-size:12px;color:#6d869f;font-weight:bold;fill:#6d869f;" transform="rotate(270 26 192)" text-anchor="middle"><tspan x="26">Combined Performance</tspan></text><path d="M 58 330.5 L 690 330.5" fill="none" stroke="#C0D0E0" stroke-width="1" ></path><g class="highcharts-tooltip" visibility="hidden"><rect rx="5" ry="5" fill="none" x="2" y="2" width="0" height="0" stroke-width="5" fill-opacity="0.85" stroke="rgb(0, 0, 0)" stroke-opacity="0.05" transform="translate(1,1)"></rect><rect rx="5" ry="5" fill="none" x="2" y="2" width="0" height="0" stroke-width="3" fill-opacity="0.85" stroke="rgb(0, 0, 0)" stroke-opacity="0.1" transform="translate(1,1)"></rect><rect rx="5" ry="5" fill="none" x="2" y="2" width="0" height="0" stroke-width="1" fill-opacity="0.85" stroke="rgb(0, 0, 0)" stroke-opacity="0.15000000000000002" transform="translate(1,1)"></rect><rect rx="5" ry="5" fill="rgb(255,255,255)" x="2" y="2" width="0" height="0" stroke-width="2" fill-opacity="0.85"></rect><text x="2" y="14" style="font-family:verdana, arial, helvetica, sans-serif;font-size:12px;color:#333333;padding:0;white-space:nowrap;fill:#333333;" ><tspan x="2"> </tspan></text></g><text x="690" y="417" style="font-family:verdana, arial, helvetica, sans-serif;font-size:10px;cursor:pointer;color:#909090;fill:#909090;" text-anchor="end" ><tspan x="690"> </tspan></text><g class="highcharts-tracker" transform="translate(58,55)"><rect rx="0" ry="0" fill="rgb(192,192,192)" x="82" y="16" width="150" height="258" stroke-width="0.000001" fill-opacity="0.000001" visibility="visible" style="cursor:pointer;"></rect><rect rx="0" ry="0" fill="rgb(192,192,192)" x="398" y="75" width="150" height="199" stroke-width="0.000001" fill-opacity="0.000001" visibility="visible" style="cursor:pointer;"></rect></g></svg>&filename=chart&type=image/png"

当我回显 svg 的值时,我在浏览器中看到了完美的 SVG 图像。

4

0 回答 0