Browse Source

使用echart

pull/26/head
ibuler 9 years ago
parent
commit
f31bea2c70
  1. 1
      jumpserver/urls.py
  2. 4
      jumpserver/views.py
  3. 1
      static/js/echarts/chart/bar.js
  4. 1
      static/js/echarts/chart/chord.js
  5. 1
      static/js/echarts/chart/eventRiver.js
  6. 1
      static/js/echarts/chart/force.js
  7. 1
      static/js/echarts/chart/funnel.js
  8. 1
      static/js/echarts/chart/gauge.js
  9. 1
      static/js/echarts/chart/heatmap.js
  10. 1
      static/js/echarts/chart/k.js
  11. 1
      static/js/echarts/chart/line.js
  12. 13
      static/js/echarts/chart/map.js
  13. 1
      static/js/echarts/chart/pie.js
  14. 1
      static/js/echarts/chart/radar.js
  15. 1
      static/js/echarts/chart/scatter.js
  16. 1
      static/js/echarts/chart/tree.js
  17. 1
      static/js/echarts/chart/treemap.js
  18. 1
      static/js/echarts/chart/venn.js
  19. 2
      static/js/echarts/chart/wordCloud.js
  20. 35
      static/js/echarts/echarts-all.js
  21. 20
      static/js/echarts/echarts.js
  22. 9
      templates/foot_script.html
  23. 104
      templates/test2.html

1
jumpserver/urls.py

@ -19,5 +19,6 @@ urlpatterns = patterns('',
(r'^jlog/', include('jlog.urls')),
(r'^jperm/', include('jperm.urls')),
(r'^node_auth/', 'jumpserver.views.node_auth'),
(r'test2', 'jumpserver.views.test2'),
)

4
jumpserver/views.py

@ -281,6 +281,10 @@ def setting(request):
msg = "设置成功"
return my_render('setting.html', locals(), request)
def test2(request):
return my_render('test2.html', locals(), request)
#
# def filter_ajax_api(request):
# attr = request.GET.get('attr', 'user')

1
static/js/echarts/chart/bar.js

File diff suppressed because one or more lines are too long

1
static/js/echarts/chart/chord.js

File diff suppressed because one or more lines are too long

1
static/js/echarts/chart/eventRiver.js

File diff suppressed because one or more lines are too long

1
static/js/echarts/chart/force.js

File diff suppressed because one or more lines are too long

1
static/js/echarts/chart/funnel.js

File diff suppressed because one or more lines are too long

1
static/js/echarts/chart/gauge.js

File diff suppressed because one or more lines are too long

1
static/js/echarts/chart/heatmap.js

@ -0,0 +1 @@
define("echarts/chart/heatmap",["require","./base","../layer/heatmap","../config","../util/ecData","zrender/tool/util","zrender/tool/color","zrender/shape/Image","../chart"],function(e){function t(e,t,n,a,o){i.call(this,e,t,n,a,o),this.refresh(a)}var i=e("./base"),n=e("../layer/heatmap"),a=e("../config"),o=(e("../util/ecData"),e("zrender/tool/util")),r=(e("zrender/tool/color"),e("zrender/shape/Image"));return a.heatmap={zlevel:0,z:2,clickable:!0},t.prototype={type:a.CHART_TYPE_HEATMAP,refresh:function(e){this.clear(),e&&(this.option=e,this.series=e.series),this._init()},_init:function(){var e=this.series;this.backupShapeList();for(var t=e.length,i=0;t>i;++i)if(e[i].type===a.CHART_TYPE_HEATMAP){e[i]=this.reformOption(e[i]);var o=new n(e[i]),s=o.getCanvas(e[i].data,this.zr.getWidth(),this.zr.getHeight()),l=new r({position:[0,0],scale:[1,1],hoverable:this.option.hoverable,style:{x:0,y:0,image:s,width:s.width,height:s.height}});this.shapeList.push(l)}this.addShapeList()}},o.inherits(t,i),e("../chart").define("heatmap",t),t}),define("echarts/layer/heatmap",["require"],function(){function e(e){if(this.option=e,e)for(var i in t)this.option[i]=void 0!==e[i]?e[i]:t[i];else this.option=t}var t={blurSize:30,gradientColors:["blue","cyan","lime","yellow","red"],minAlpha:.05,valueScale:1,opacity:1},i=20,n=256;return e.prototype={getCanvas:function(e,t,a){var o=this._getBrush(),r=this._getGradient(),s=i+this.option.blurSize,l=document.createElement("canvas");l.width=t,l.height=a;for(var h=l.getContext("2d"),m=e.length,V=0;m>V;++V){var d=e[V],U=d[0],p=d[1],c=d[2],u=Math.min(1,Math.max(c*this.option.valueScale||this.option.minAlpha,this.option.minAlpha));h.globalAlpha=u,h.drawImage(o,U-s,p-s)}for(var g=h.getImageData(0,0,l.width,l.height),y=g.data,m=y.length/4;m--;){var b=4*m+3,u=y[b]/256,f=Math.floor(u*(n-1));y[b-3]=r[4*f],y[b-2]=r[4*f+1],y[b-1]=r[4*f+2],y[b]*=this.option.opacity}return h.putImageData(g,0,0),l},_getBrush:function(){if(!this._brushCanvas){this._brushCanvas=document.createElement("canvas");var e=i+this.option.blurSize,t=2*e;this._brushCanvas.width=t,this._brushCanvas.height=t;var n=this._brushCanvas.getContext("2d");n.shadowOffsetX=t,n.shadowBlur=this.option.blurSize,n.shadowColor="black",n.beginPath(),n.arc(-e,e,i,0,2*Math.PI,!0),n.closePath(),n.fill()}return this._brushCanvas},_getGradient:function(){if(!this._gradientPixels){var e=n,t=document.createElement("canvas");t.width=1,t.height=e;for(var i=t.getContext("2d"),a=i.createLinearGradient(0,0,0,e),o=this.option.gradientColors.length,r=0;o>r;++r)"string"==typeof this.option.gradientColors[r]?a.addColorStop((r+1)/o,this.option.gradientColors[r]):a.addColorStop(this.option.gradientColors[r].offset,this.option.gradientColors[r].color);i.fillStyle=a,i.fillRect(0,0,1,e),this._gradientPixels=i.getImageData(0,0,1,e).data}return this._gradientPixels}},e}),define("echarts/layer/heatmap",["require"],function(){function e(e){if(this.option=e,e)for(var i in t)this.option[i]=void 0!==e[i]?e[i]:t[i];else this.option=t}var t={blurSize:30,gradientColors:["blue","cyan","lime","yellow","red"],minAlpha:.05,valueScale:1,opacity:1},i=20,n=256;return e.prototype={getCanvas:function(e,t,a){var o=this._getBrush(),r=this._getGradient(),s=i+this.option.blurSize,l=document.createElement("canvas");l.width=t,l.height=a;for(var h=l.getContext("2d"),m=e.length,V=0;m>V;++V){var d=e[V],U=d[0],p=d[1],c=d[2],u=Math.min(1,Math.max(c*this.option.valueScale||this.option.minAlpha,this.option.minAlpha));h.globalAlpha=u,h.drawImage(o,U-s,p-s)}for(var g=h.getImageData(0,0,l.width,l.height),y=g.data,m=y.length/4;m--;){var b=4*m+3,u=y[b]/256,f=Math.floor(u*(n-1));y[b-3]=r[4*f],y[b-2]=r[4*f+1],y[b-1]=r[4*f+2],y[b]*=this.option.opacity}return h.putImageData(g,0,0),l},_getBrush:function(){if(!this._brushCanvas){this._brushCanvas=document.createElement("canvas");var e=i+this.option.blurSize,t=2*e;this._brushCanvas.width=t,this._brushCanvas.height=t;var n=this._brushCanvas.getContext("2d");n.shadowOffsetX=t,n.shadowBlur=this.option.blurSize,n.shadowColor="black",n.beginPath(),n.arc(-e,e,i,0,2*Math.PI,!0),n.closePath(),n.fill()}return this._brushCanvas},_getGradient:function(){if(!this._gradientPixels){var e=n,t=document.createElement("canvas");t.width=1,t.height=e;for(var i=t.getContext("2d"),a=i.createLinearGradient(0,0,0,e),o=this.option.gradientColors.length,r=0;o>r;++r)"string"==typeof this.option.gradientColors[r]?a.addColorStop((r+1)/o,this.option.gradientColors[r]):a.addColorStop(this.option.gradientColors[r].offset,this.option.gradientColors[r].color);i.fillStyle=a,i.fillRect(0,0,1,e),this._gradientPixels=i.getImageData(0,0,1,e).data}return this._gradientPixels}},e});

1
static/js/echarts/chart/k.js

File diff suppressed because one or more lines are too long

1
static/js/echarts/chart/line.js

File diff suppressed because one or more lines are too long

13
static/js/echarts/chart/map.js

File diff suppressed because one or more lines are too long

1
static/js/echarts/chart/pie.js

File diff suppressed because one or more lines are too long

1
static/js/echarts/chart/radar.js

File diff suppressed because one or more lines are too long

1
static/js/echarts/chart/scatter.js

File diff suppressed because one or more lines are too long

1
static/js/echarts/chart/tree.js

File diff suppressed because one or more lines are too long

1
static/js/echarts/chart/treemap.js

File diff suppressed because one or more lines are too long

1
static/js/echarts/chart/venn.js

File diff suppressed because one or more lines are too long

2
static/js/echarts/chart/wordCloud.js

File diff suppressed because one or more lines are too long

35
static/js/echarts/echarts-all.js

File diff suppressed because one or more lines are too long

20
static/js/echarts/echarts.js

File diff suppressed because one or more lines are too long

9
templates/foot_script.html

@ -23,6 +23,15 @@
<!-- highcharts -->
<script src="/static/js/highcharts/highcharts.js"></script>
<script type="text/javascript">
require.config({
paths: {
echarts: '/static/js/echarts/chart'
}
});
</script>
<!-- echarts -->
<script src="/static/js/echarts/echarts.js"></script>
<script src="/static/js/dropzone/dropzone.js"></script>
<!-- active menu -->

104
templates/test2.html

@ -1,10 +1,96 @@
<!DOCTYPE html>
<html>
<head><title>Poem Maker Pro</title></head>
<body>
<h1>Your poem</h1>
<p>Two {{roads}} diverged in a {{wood}}, and I—<br>
I took the one less travelled by,<br>
And that has {{made}} all the {{difference}}.</p>
</body>
</html>
<body>
<div id="main" style="height:400px;"></div>
...
<script src="/static/js/echarts/echarts.js"></script>
<script type="text/javascript">
require.config({
paths: {
{# 'echarts': '/static/js/echarts/chart',#}
'line': '/static/js/echarts/chart/line'
}
});
require(
[
'line',
],
function (ec) {
var myChart = ec.init(document.getElementById('main'));
var option = {
title : {
text: '未来一周气温变化',
subtext: '纯属虚构'
},
tooltip : {
trigger: 'axis'
},
legend: {
data:['最高气温','最低气温']
},
toolbox: {
show : true,
feature : {
mark : {show: true},
dataView : {show: true, readOnly: false},
magicType : {show: true, type: ['line', 'bar']},
restore : {show: true},
saveAsImage : {show: true}
}
},
calculable : true,
xAxis : [
{
type : 'category',
boundaryGap : false,
data : ['周一','周二','周三','周四','周五','周六','周日']
}
],
yAxis : [
{
type : 'value',
axisLabel : {
formatter: '{value} °C'
}
}
],
series : [
{
name:'最高气温',
type:'line',
data:[11, 11, 15, 13, 12, 13, 10],
markPoint : {
data : [
{type : 'max', name: '最大值'},
{type : 'min', name: '最小值'}
]
},
markLine : {
data : [
{type : 'average', name: '平均值'}
]
}
},
{
name:'最低气温',
type:'line',
data:[1, -2, 2, 5, 3, 2, 0],
markPoint : {
data : [
{name : '周最低', value : -2, xAxis: 1, yAxis: -1.5}
]
},
markLine : {
data : [
{type : 'average', name : '平均值'}
]
}
}
]
};
myChart.setOption(option);
}
);
</script>
</body>
</html>

Loading…
Cancel
Save