<?php
/**
* This file is part of the exporting module for Highcharts JS.
* www.highcharts.com/license
*
*
* Available POST variables:
*
* $filename string The desired filename without extension
* $type string The MIME type for export.
* $width int The pixel width of the exported raster image. The height is calculated.
* $svg string The SVG source code to convert.
*/
// Options
define ('BATIK_PATH', 'batik-rasterizer.jar');
///////////////////////////////////////////////////////////////////////////////
$type = $_POST['type'];
$svg = (string) $_POST['svg'];
$filename = (string) $_POST['filename'];
// prepare variables
if (!$filename) $filename = 'chart';
if (get_magic_quotes_gpc()) {
$svg = stripslashes($svg);
}
$tempName = md5(rand());
// allow no other than predefined types
if ($type == 'image/png') {
$typeString = '-m image/png';
$ext = 'png';
} elseif ($type == 'image/jpeg') {
$typeString = '-m image/jpeg';
$ext = 'jpg';
} elseif ($type == 'application/pdf') {
$typeString = '-m application/pdf';
$ext = 'pdf';
} elseif ($type == 'image/svg+xml') {
$ext = 'svg';
}
$outfile = "temp/$tempName.$ext";
if (isset($typeString)) {
// size
if ($_POST['width']) {
$width = (int)$_POST['width'];
if ($width) $width = "-w $width";
}
// generate the temporary file
if (!file_put_contents("temp/$tempName.svg", $svg)) {
die("Couldn't create temporary file. Check that the directory permissions for
the /temp directory are set to 777.");
}
// do the conversion
$output = shell_exec("java -jar ". BATIK_PATH ." $typeString -d $outfile $width temp/$tempName.svg");
// catch error
if (!is_file($outfile) || filesize($outfile) < 10) {
echo "<pre>$output</pre>";
echo "Error while converting SVG";
}
// stream it
else {
header("Content-Disposition: attachment; filename=$filename.$ext");
header("Content-Type: $type");
echo file_get_contents($outfile);
}
// delete it
unlink("temp/$tempName.svg");
unlink($outfile);
// SVG can be streamed directly back
} else if ($ext == 'svg') {
header("Content-Disposition: attachment; filename=$filename.$ext");
header("Content-Type: $type");
echo $svg;
} else {
echo "Invalid type";
}
?>
没有合适的资源?快使用搜索试试~ 我知道了~
js 柱状图 饼状图 曲线图 等
共53个文件
htm:36个
js:10个
png:2个
4星 · 超过85%的资源 需积分: 9 16 下载量 45 浏览量
2013-04-15
11:47:46
上传
评论
收藏 208KB ZIP 举报
温馨提示
js 柱状图 饼状图 曲线图 等 漂亮 可直接html运行,无需任何插件
资源推荐
资源详情
资源评论
收起资源包目录
js统计图形(Highcharts-2.1.0).zip (53个子文件)
exporting-server
index.php 2KB
js
adapters
mootools-adapter.src.js 5KB
mootools-adapter.js 1KB
modules
exporting.src.js 16KB
exporting.js 6KB
highcharts.src.js 256KB
highcharts.js 75KB
themes
gray.js 3KB
dark-green.js 3KB
grid.js 2KB
dark-blue.js 3KB
examples
line-basic.htm 2KB
combo-dual-axes.htm 3KB
line-labels.htm 2KB
combo-regression.htm 2KB
area-missing.htm 2KB
area-negative.htm 2KB
column-parsed.htm 3KB
column-rotated-labels.htm 3KB
area-stacked.htm 2KB
area-basic.htm 3KB
combo.htm 3KB
pie-legend.htm 2KB
analytics.tsv 3KB
dynamic-click-to-add.htm 2KB
pie-basic.htm 2KB
column-stacked-percent.htm 2KB
line-time-series.htm 12KB
dynamic-update.htm 2KB
scatter.htm 11KB
combo-multi-axes.htm 3KB
spline-inverted.htm 2KB
areaspline.htm 2KB
dynamic-master-detail.htm 15KB
area-stacked-percent.htm 2KB
area-inverted.htm 2KB
tokyo.json 68B
spline-plot-bands.htm 4KB
analytics.csv 3KB
line-ajax.htm 5KB
bar-negative-stack.htm 3KB
column-basic.htm 3KB
spline-symbols.htm 2KB
column-negative.htm 2KB
pie-donut.htm 3KB
bar-stacked.htm 2KB
column-stacked-and-grouped.htm 2KB
column-stacked.htm 2KB
bar-basic.htm 2KB
index.htm 3KB
graphics
sun.png 4KB
snow.png 5KB
skies.jpg 42KB
共 53 条
- 1
资源评论
- huo_fengxiaoxiao2013-05-02很好用,希望能帮助你们
小葫芦
- 粉丝: 2
- 资源: 16
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功