<?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 ($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";
}
?>
没有合适的资源?快使用搜索试试~ 我知道了~
漂亮实用的图表API:Highcharts 纯js实现
共182个文件
htm:122个
js:24个
csv:24个
5星 · 超过95%的资源 需积分: 0 14 下载量 191 浏览量
2011-11-28
22:36:39
上传
评论
收藏 1.11MB ZIP 举报
温馨提示
Highcharts是一个制作统计图表的纯Javascript类库,主要特性如下: * 兼容性:兼容当今所有的浏览器,包括iPhone、IE、Chrome、Firefox等; * 开源,对个人用户完全免费,让类似wschart的图表控件见鬼去吧; * 支持大部分的图表类型:直线图,曲线图、区域图、区域曲线图、柱状图、饼装图、散布图、柏拉图; * 纯JS,跨语言:不管是Asp、PHP、Asp.net还是Java都可以使用,它只需要三个文件:一个是Highcharts的核心文件highcharts.js,二是支持打印和导出图片的exporting.js,三是Jquery类库(jquery.min.js)或者MooTools类库; * 提示功能:鼠标移动到图表的某一点上有提示信息; * 放大功能:选中图表部分放大,近距离观察图表;
资源推荐
资源详情
资源评论
收起资源包目录
漂亮实用的图表API:Highcharts 纯js实现 (182个子文件)
data.csv 100KB
data.csv 100KB
data.csv 100KB
data.csv 100KB
data.csv 100KB
data.csv 100KB
data.csv 100KB
data.csv 100KB
data.csv 100KB
data.csv 100KB
data.csv 100KB
data.csv 100KB
data.csv 100KB
data.csv 100KB
data.csv 100KB
data.csv 99KB
data.csv 99KB
data.csv 99KB
data.csv 99KB
GOOGL.csv 53KB
MSFT.csv 49KB
ADBE.csv 49KB
data.csv 19KB
analytics.csv 3KB
dynamic-master-detail.htm 15KB
dynamic-master-detail.htm 15KB
line-time-series.htm 12KB
line-time-series.htm 12KB
scatter.htm 11KB
scatter.htm 11KB
line-ajax.htm 5KB
line-ajax.htm 5KB
spline-irregular-time.htm 5KB
spline-plot-bands.htm 4KB
spline-irregular-time.htm 4KB
column-drilldown.htm 4KB
spline-plot-bands.htm 4KB
column-drilldown.htm 4KB
index.htm 4KB
index.htm 4KB
flags-general.htm 3KB
combo-multi-axes.htm 3KB
combo-multi-axes.htm 3KB
column-parsed.htm 3KB
index.htm 3KB
area-basic.htm 3KB
column-parsed.htm 3KB
index.htm 3KB
area-basic.htm 3KB
flags-shapes.htm 3KB
index.htm 3KB
candlestick-and-volume.htm 3KB
index.htm 3KB
bar-negative-stack.htm 3KB
combo-dual-axes.htm 3KB
index.htm 3KB
combo-dual-axes.htm 3KB
bar-negative-stack.htm 3KB
multiple-series.htm 3KB
column-rotated-labels.htm 3KB
index.htm 3KB
column-rotated-labels.htm 3KB
index.htm 3KB
dynamic-update.htm 3KB
pie-donut.htm 3KB
ohlc.htm 3KB
pie-donut.htm 3KB
column-basic.htm 3KB
data-grouping.htm 3KB
index.htm 3KB
combo.htm 3KB
dynamic-update.htm 2KB
column-basic.htm 2KB
line-basic.htm 2KB
combo.htm 2KB
area-stacked.htm 2KB
area-stacked-percent.htm 2KB
column-stacked.htm 2KB
flags-placement.htm 2KB
line-basic.htm 2KB
area-stacked.htm 2KB
area-missing.htm 2KB
spline-symbols.htm 2KB
index.htm 2KB
index.htm 2KB
area-stacked-percent.htm 2KB
dynamic-click-to-add.htm 2KB
candlestick.htm 2KB
intraday.htm 2KB
spline-inverted.htm 2KB
area-inverted.htm 2KB
bar-basic.htm 2KB
area-missing.htm 2KB
area-inverted.htm 2KB
spline-symbols.htm 2KB
bar-basic.htm 2KB
index.htm 2KB
dynamic-click-to-add.htm 2KB
spline-inverted.htm 2KB
areaspline.htm 2KB
共 182 条
- 1
- 2
资源评论
- 一页纸2012-07-22非常好用 asp的
彼岸繁华地
- 粉丝: 12
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功