<?php
/**
* This file is part of the exporting module for Highcharts JS.
* www.highcharts.com/license
*
*
* Available POST variables:
*
* $tempName 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');
///////////////////////////////////////////////////////////////////////////////
ini_set('magic_quotes_gpc', 'off');
$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. ";
if (strpos($output, 'SVGConverter.error.while.rasterizing.file') !== false) {
echo "SVG code for debugging: <hr/>";
echo htmlentities($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";
}
?>
没有合适的资源?快使用搜索试试~ 我知道了~
Highcharts开源的JS图表控件简介
共59个文件
htm:38个
js:15个
png:2个
需积分: 9 7 下载量 177 浏览量
2012-12-17
11:12:38
上传
评论
收藏 269KB RAR 举报
温馨提示
Highcharts开源的JS图表控件简介:制作图表的纯Js控件,Highcharts v2.2.0主要特性:兼容当今所有的浏览器,包括iPhone、IE和火狐等等;对个人用户完全免费;纯JS,无BS支持大部分的图表类型:直线图,曲线图、区域图、区域曲线图、柱状图、饼装图、散布图;PHP、Asp.net还是Java都可以使用highcharts.js还有IE和Jquery类库或者MooTools类库;提示功能:鼠标移动到图表的某一点上有提示信息;选中图表部分放大,近距离观察图表。
资源推荐
资源详情
资源评论
收起资源包目录
Highcharts-2.2.0.rar (59个子文件)
exporting-server
index.php 2KB
js
adapters
prototype-adapter.js 3KB
mootools-adapter.src.js 7KB
mootools-adapter.js 2KB
prototype-adapter.src.js 9KB
modules
exporting.src.js 17KB
canvas-tools.src.js 98KB
canvas-tools.js 57KB
exporting.js 7KB
highcharts.src.js 329KB
highcharts.js 95KB
themes
gray.js 4KB
dark-green.js 4KB
grid.js 2KB
dark-blue.js 4KB
skies.js 2KB
examples
area-missing
index.htm 2KB
spline-inverted
index.htm 2KB
spline-plot-bands
index.htm 3KB
areaspline
index.htm 2KB
spline-symbols
index.htm 2KB
column-drilldown
index.htm 7KB
line-ajax
analytics.tsv 3KB
index.htm 4KB
column-stacked
index.htm 2KB
bar-basic
index.htm 2KB
line-labels
index.htm 1KB
combo-multi-axes
index.htm 3KB
spline-irregular-time
index.htm 4KB
line-time-series
index.htm 11KB
pie-donut
index.htm 3KB
dynamic-master-detail
index.htm 14KB
dynamic-update
index.htm 2KB
dynamic-click-to-add
index.htm 2KB
combo
index.htm 2KB
line-basic
index.htm 2KB
column-stacked-percent
index.htm 1KB
column-stacked-and-grouped
index.htm 1KB
column-basic
index.htm 2KB
scatter
index.htm 10KB
column-negative
index.htm 1KB
column-rotated-labels
index.htm 894B
data.josn 1KB
area-inverted
index.htm 2KB
combo-regression
index.htm 1KB
pie-basic
index.htm 1KB
pie-legend
index.htm 1KB
combo-dual-axes
index.htm 639B
bar-stacked
index.htm 1KB
bar-negative-stack
index.htm 2KB
column-parsed
index.htm 3KB
area-negative
index.htm 1KB
area-basic
index.htm 3KB
area-stacked
index.htm 2KB
area-stacked-percent
index.htm 2KB
index.htm 3KB
graphics
sun.png 4KB
snow.png 5KB
skies.jpg 42KB
共 59 条
- 1
资源评论
yanbin_cheng
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功