v3.4.0
2
source/vue/exam-admin/.browserslistrc
Normal file
@@ -0,0 +1,2 @@
|
||||
> 1%
|
||||
last 2 versions
|
||||
5
source/vue/exam-admin/.editorconfig
Normal file
@@ -0,0 +1,5 @@
|
||||
[*.{js,jsx,ts,tsx,vue}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
1
source/vue/exam-admin/.env
Normal file
@@ -0,0 +1 @@
|
||||
timeOut=30
|
||||
1
source/vue/exam-admin/.env.dev
Normal file
@@ -0,0 +1 @@
|
||||
NODE_ENV = 'development'
|
||||
1
source/vue/exam-admin/.env.pre
Normal file
@@ -0,0 +1 @@
|
||||
NODE_ENV = 'production'
|
||||
1
source/vue/exam-admin/.env.prod
Normal file
@@ -0,0 +1 @@
|
||||
NODE_ENV = 'production'
|
||||
1
source/vue/exam-admin/.env.test
Normal file
@@ -0,0 +1 @@
|
||||
NODE_ENV = 'production'
|
||||
2
source/vue/exam-admin/.eslintignore
Normal file
@@ -0,0 +1,2 @@
|
||||
/public/admin/components/ueditor
|
||||
/public/admin/components/echarts
|
||||
17
source/vue/exam-admin/.eslintrc.js
Normal file
@@ -0,0 +1,17 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
node: true
|
||||
},
|
||||
'extends': [
|
||||
'plugin:vue/essential',
|
||||
'@vue/standard'
|
||||
],
|
||||
rules: {
|
||||
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
|
||||
},
|
||||
parserOptions: {
|
||||
parser: 'babel-eslint'
|
||||
}
|
||||
}
|
||||
22
source/vue/exam-admin/.gitignore
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
/admin
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
5
source/vue/exam-admin/babel.config.js
Normal file
@@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
}
|
||||
12656
source/vue/exam-admin/package-lock.json
generated
Normal file
44
source/vue/exam-admin/package.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "exam-admin",
|
||||
"version": "3.0.4",
|
||||
"author": "alvis",
|
||||
"description": "学之思管理系统",
|
||||
"license": "AGPL-3.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve --mode dev",
|
||||
"build": "vue-cli-service build --mode prod",
|
||||
"build:dev": "vue-cli-service build --mode dev",
|
||||
"build:test": "vue-cli-service build --mode test",
|
||||
"build:pre": "vue-cli-service build --mode pre",
|
||||
"build:prod": "vue-cli-service build --mode prod",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.19.0",
|
||||
"core-js": "^3.4.4",
|
||||
"element-ui": "^2.13.0",
|
||||
"vue": "^2.6.10",
|
||||
"vue-router": "^3.1.3",
|
||||
"vuex": "^3.1.2",
|
||||
"normalize.css": "8.0.1",
|
||||
"js-cookie": "2.2.0",
|
||||
"nprogress": "0.2.0",
|
||||
"vue-count-to": "^1.0.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "^4.1.0",
|
||||
"@vue/cli-plugin-eslint": "^4.1.0",
|
||||
"@vue/cli-plugin-router": "^4.1.0",
|
||||
"@vue/cli-plugin-vuex": "^4.1.0",
|
||||
"@vue/cli-service": "^4.1.0",
|
||||
"@vue/eslint-config-standard": "^4.0.0",
|
||||
"babel-eslint": "^10.0.3",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-plugin-vue": "^5.0.0",
|
||||
"node-sass": "^4.12.0",
|
||||
"sass-loader": "^8.0.0",
|
||||
"vue-template-compiler": "^2.6.10",
|
||||
"svg-sprite-loader": "4.1.6"
|
||||
}
|
||||
}
|
||||
5
source/vue/exam-admin/postcss.config.js
Normal file
@@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
plugins: {
|
||||
autoprefixer: {}
|
||||
}
|
||||
}
|
||||
22
source/vue/exam-admin/public/admin/components/echarts/echarts-en.common.min.js
vendored
Normal file
93880
source/vue/exam-admin/public/admin/components/echarts/echarts-en.js
Normal file
22
source/vue/exam-admin/public/admin/components/echarts/echarts-en.min.js
vendored
Normal file
22
source/vue/exam-admin/public/admin/components/echarts/echarts-en.simple.min.js
vendored
Normal file
61149
source/vue/exam-admin/public/admin/components/echarts/echarts.common.js
Normal file
22
source/vue/exam-admin/public/admin/components/echarts/echarts.common.min.js
vendored
Normal file
93938
source/vue/exam-admin/public/admin/components/echarts/echarts.js
Normal file
22
source/vue/exam-admin/public/admin/components/echarts/echarts.min.js
vendored
Normal file
41832
source/vue/exam-admin/public/admin/components/echarts/echarts.simple.js
Normal file
22
source/vue/exam-admin/public/admin/components/echarts/echarts.simple.min.js
vendored
Normal file
@@ -0,0 +1,418 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('echarts')) :
|
||||
typeof define === 'function' && define.amd ? define(['exports', 'echarts'], factory) :
|
||||
(factory((global.bmap = {}),global.echarts));
|
||||
}(this, (function (exports,echarts) { 'use strict';
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/* global BMap */
|
||||
|
||||
function BMapCoordSys(bmap, api) {
|
||||
this._bmap = bmap;
|
||||
this.dimensions = ['lng', 'lat'];
|
||||
this._mapOffset = [0, 0];
|
||||
|
||||
this._api = api;
|
||||
|
||||
this._projection = new BMap.MercatorProjection();
|
||||
}
|
||||
|
||||
BMapCoordSys.prototype.dimensions = ['lng', 'lat'];
|
||||
|
||||
BMapCoordSys.prototype.setZoom = function (zoom) {
|
||||
this._zoom = zoom;
|
||||
};
|
||||
|
||||
BMapCoordSys.prototype.setCenter = function (center) {
|
||||
this._center = this._projection.lngLatToPoint(new BMap.Point(center[0], center[1]));
|
||||
};
|
||||
|
||||
BMapCoordSys.prototype.setMapOffset = function (mapOffset) {
|
||||
this._mapOffset = mapOffset;
|
||||
};
|
||||
|
||||
BMapCoordSys.prototype.getBMap = function () {
|
||||
return this._bmap;
|
||||
};
|
||||
|
||||
BMapCoordSys.prototype.dataToPoint = function (data) {
|
||||
var point = new BMap.Point(data[0], data[1]);
|
||||
// TODO mercator projection is toooooooo slow
|
||||
// var mercatorPoint = this._projection.lngLatToPoint(point);
|
||||
|
||||
// var width = this._api.getZr().getWidth();
|
||||
// var height = this._api.getZr().getHeight();
|
||||
// var divider = Math.pow(2, 18 - 10);
|
||||
// return [
|
||||
// Math.round((mercatorPoint.x - this._center.x) / divider + width / 2),
|
||||
// Math.round((this._center.y - mercatorPoint.y) / divider + height / 2)
|
||||
// ];
|
||||
var px = this._bmap.pointToOverlayPixel(point);
|
||||
var mapOffset = this._mapOffset;
|
||||
return [px.x - mapOffset[0], px.y - mapOffset[1]];
|
||||
};
|
||||
|
||||
BMapCoordSys.prototype.pointToData = function (pt) {
|
||||
var mapOffset = this._mapOffset;
|
||||
var pt = this._bmap.overlayPixelToPoint({
|
||||
x: pt[0] + mapOffset[0],
|
||||
y: pt[1] + mapOffset[1]
|
||||
});
|
||||
return [pt.lng, pt.lat];
|
||||
};
|
||||
|
||||
BMapCoordSys.prototype.getViewRect = function () {
|
||||
var api = this._api;
|
||||
return new echarts.graphic.BoundingRect(0, 0, api.getWidth(), api.getHeight());
|
||||
};
|
||||
|
||||
BMapCoordSys.prototype.getRoamTransform = function () {
|
||||
return echarts.matrix.create();
|
||||
};
|
||||
|
||||
BMapCoordSys.prototype.prepareCustoms = function (data) {
|
||||
var rect = this.getViewRect();
|
||||
return {
|
||||
coordSys: {
|
||||
// The name exposed to user is always 'cartesian2d' but not 'grid'.
|
||||
type: 'bmap',
|
||||
x: rect.x,
|
||||
y: rect.y,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
},
|
||||
api: {
|
||||
coord: echarts.util.bind(this.dataToPoint, this),
|
||||
size: echarts.util.bind(dataToCoordSize, this)
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
function dataToCoordSize(dataSize, dataItem) {
|
||||
dataItem = dataItem || [0, 0];
|
||||
return echarts.util.map([0, 1], function (dimIdx) {
|
||||
var val = dataItem[dimIdx];
|
||||
var halfSize = dataSize[dimIdx] / 2;
|
||||
var p1 = [];
|
||||
var p2 = [];
|
||||
p1[dimIdx] = val - halfSize;
|
||||
p2[dimIdx] = val + halfSize;
|
||||
p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];
|
||||
return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);
|
||||
}, this);
|
||||
}
|
||||
|
||||
var Overlay;
|
||||
|
||||
// For deciding which dimensions to use when creating list data
|
||||
BMapCoordSys.dimensions = BMapCoordSys.prototype.dimensions;
|
||||
|
||||
function createOverlayCtor() {
|
||||
function Overlay(root) {
|
||||
this._root = root;
|
||||
}
|
||||
|
||||
Overlay.prototype = new BMap.Overlay();
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @param {BMap.Map} map
|
||||
* @override
|
||||
*/
|
||||
Overlay.prototype.initialize = function (map) {
|
||||
map.getPanes().labelPane.appendChild(this._root);
|
||||
return this._root;
|
||||
};
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
Overlay.prototype.draw = function () {};
|
||||
|
||||
return Overlay;
|
||||
}
|
||||
|
||||
BMapCoordSys.create = function (ecModel, api) {
|
||||
var bmapCoordSys;
|
||||
var root = api.getDom();
|
||||
|
||||
// TODO Dispose
|
||||
ecModel.eachComponent('bmap', function (bmapModel) {
|
||||
var painter = api.getZr().painter;
|
||||
var viewportRoot = painter.getViewportRoot();
|
||||
if (typeof BMap === 'undefined') {
|
||||
throw new Error('BMap api is not loaded');
|
||||
}
|
||||
Overlay = Overlay || createOverlayCtor();
|
||||
if (bmapCoordSys) {
|
||||
throw new Error('Only one bmap component can exist');
|
||||
}
|
||||
if (!bmapModel.__bmap) {
|
||||
// Not support IE8
|
||||
var bmapRoot = root.querySelector('.ec-extension-bmap');
|
||||
if (bmapRoot) {
|
||||
// Reset viewport left and top, which will be changed
|
||||
// in moving handler in BMapView
|
||||
viewportRoot.style.left = '0px';
|
||||
viewportRoot.style.top = '0px';
|
||||
root.removeChild(bmapRoot);
|
||||
}
|
||||
bmapRoot = document.createElement('div');
|
||||
bmapRoot.style.cssText = 'width:100%;height:100%';
|
||||
// Not support IE8
|
||||
bmapRoot.classList.add('ec-extension-bmap');
|
||||
root.appendChild(bmapRoot);
|
||||
var bmap = bmapModel.__bmap = new BMap.Map(bmapRoot);
|
||||
|
||||
var overlay = new Overlay(viewportRoot);
|
||||
bmap.addOverlay(overlay);
|
||||
|
||||
// Override
|
||||
painter.getViewportRootOffset = function () {
|
||||
return {offsetLeft: 0, offsetTop: 0};
|
||||
};
|
||||
}
|
||||
var bmap = bmapModel.__bmap;
|
||||
|
||||
// Set bmap options
|
||||
// centerAndZoom before layout and render
|
||||
var center = bmapModel.get('center');
|
||||
var zoom = bmapModel.get('zoom');
|
||||
if (center && zoom) {
|
||||
var pt = new BMap.Point(center[0], center[1]);
|
||||
bmap.centerAndZoom(pt, zoom);
|
||||
}
|
||||
|
||||
bmapCoordSys = new BMapCoordSys(bmap, api);
|
||||
bmapCoordSys.setMapOffset(bmapModel.__mapOffset || [0, 0]);
|
||||
bmapCoordSys.setZoom(zoom);
|
||||
bmapCoordSys.setCenter(center);
|
||||
|
||||
bmapModel.coordinateSystem = bmapCoordSys;
|
||||
});
|
||||
|
||||
ecModel.eachSeries(function (seriesModel) {
|
||||
if (seriesModel.get('coordinateSystem') === 'bmap') {
|
||||
seriesModel.coordinateSystem = bmapCoordSys;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
function v2Equal(a, b) {
|
||||
return a && b && a[0] === b[0] && a[1] === b[1];
|
||||
}
|
||||
|
||||
echarts.extendComponentModel({
|
||||
type: 'bmap',
|
||||
|
||||
getBMap: function () {
|
||||
// __bmap is injected when creating BMapCoordSys
|
||||
return this.__bmap;
|
||||
},
|
||||
|
||||
setCenterAndZoom: function (center, zoom) {
|
||||
this.option.center = center;
|
||||
this.option.zoom = zoom;
|
||||
},
|
||||
|
||||
centerOrZoomChanged: function (center, zoom) {
|
||||
var option = this.option;
|
||||
return !(v2Equal(center, option.center) && zoom === option.zoom);
|
||||
},
|
||||
|
||||
defaultOption: {
|
||||
|
||||
center: [104.114129, 37.550339],
|
||||
|
||||
zoom: 5,
|
||||
|
||||
mapStyle: {},
|
||||
|
||||
roam: false
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
echarts.extendComponentView({
|
||||
type: 'bmap',
|
||||
|
||||
render: function (bMapModel, ecModel, api) {
|
||||
var rendering = true;
|
||||
|
||||
var bmap = bMapModel.getBMap();
|
||||
var viewportRoot = api.getZr().painter.getViewportRoot();
|
||||
var coordSys = bMapModel.coordinateSystem;
|
||||
var moveHandler = function (type, target) {
|
||||
if (rendering) {
|
||||
return;
|
||||
}
|
||||
var offsetEl = viewportRoot.parentNode.parentNode.parentNode;
|
||||
var mapOffset = [
|
||||
-parseInt(offsetEl.style.left, 10) || 0,
|
||||
-parseInt(offsetEl.style.top, 10) || 0
|
||||
];
|
||||
viewportRoot.style.left = mapOffset[0] + 'px';
|
||||
viewportRoot.style.top = mapOffset[1] + 'px';
|
||||
|
||||
coordSys.setMapOffset(mapOffset);
|
||||
bMapModel.__mapOffset = mapOffset;
|
||||
|
||||
api.dispatchAction({
|
||||
type: 'bmapRoam'
|
||||
});
|
||||
};
|
||||
|
||||
function zoomEndHandler() {
|
||||
if (rendering) {
|
||||
return;
|
||||
}
|
||||
api.dispatchAction({
|
||||
type: 'bmapRoam'
|
||||
});
|
||||
}
|
||||
|
||||
bmap.removeEventListener('moving', this._oldMoveHandler);
|
||||
// FIXME
|
||||
// Moveend may be triggered by centerAndZoom method when creating coordSys next time
|
||||
// bmap.removeEventListener('moveend', this._oldMoveHandler);
|
||||
bmap.removeEventListener('zoomend', this._oldZoomEndHandler);
|
||||
bmap.addEventListener('moving', moveHandler);
|
||||
// bmap.addEventListener('moveend', moveHandler);
|
||||
bmap.addEventListener('zoomend', zoomEndHandler);
|
||||
|
||||
this._oldMoveHandler = moveHandler;
|
||||
this._oldZoomEndHandler = zoomEndHandler;
|
||||
|
||||
var roam = bMapModel.get('roam');
|
||||
if (roam && roam !== 'scale') {
|
||||
bmap.enableDragging();
|
||||
}
|
||||
else {
|
||||
bmap.disableDragging();
|
||||
}
|
||||
if (roam && roam !== 'move') {
|
||||
bmap.enableScrollWheelZoom();
|
||||
bmap.enableDoubleClickZoom();
|
||||
bmap.enablePinchToZoom();
|
||||
}
|
||||
else {
|
||||
bmap.disableScrollWheelZoom();
|
||||
bmap.disableDoubleClickZoom();
|
||||
bmap.disablePinchToZoom();
|
||||
}
|
||||
|
||||
var originalStyle = bMapModel.__mapStyle;
|
||||
|
||||
var newMapStyle = bMapModel.get('mapStyle') || {};
|
||||
// FIXME, Not use JSON methods
|
||||
var mapStyleStr = JSON.stringify(newMapStyle);
|
||||
if (JSON.stringify(originalStyle) !== mapStyleStr) {
|
||||
// FIXME May have blank tile when dragging if setMapStyle
|
||||
if (Object.keys(newMapStyle).length) {
|
||||
bmap.setMapStyle(newMapStyle);
|
||||
}
|
||||
bMapModel.__mapStyle = JSON.parse(mapStyleStr);
|
||||
}
|
||||
|
||||
rendering = false;
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* BMap component extension
|
||||
*/
|
||||
|
||||
echarts.registerCoordinateSystem('bmap', BMapCoordSys);
|
||||
|
||||
// Action
|
||||
echarts.registerAction({
|
||||
type: 'bmapRoam',
|
||||
event: 'bmapRoam',
|
||||
update: 'updateLayout'
|
||||
}, function (payload, ecModel) {
|
||||
ecModel.eachComponent('bmap', function (bMapModel) {
|
||||
var bmap = bMapModel.getBMap();
|
||||
var center = bmap.getCenter();
|
||||
bMapModel.setCenterAndZoom([center.lng, center.lat], bmap.getZoom());
|
||||
});
|
||||
});
|
||||
|
||||
var version = '1.0.0';
|
||||
|
||||
exports.version = version;
|
||||
|
||||
})));
|
||||
//# sourceMappingURL=bmap.js.map
|
||||
22
source/vue/exam-admin/public/admin/components/echarts/extension/bmap.min.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],e):e(t.bmap={},t.echarts)}(this,function(t,e){"use strict";function o(t,e){this._bmap=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=e,this._projection=new BMap.MercatorProjection}function n(t,o){return o=o||[0,0],e.util.map([0,1],function(e){var n=o[e],i=t[e]/2,a=[],r=[];return a[e]=n-i,r[e]=n+i,a[1-e]=r[1-e]=o[1-e],Math.abs(this.dataToPoint(a)[e]-this.dataToPoint(r)[e])},this)}function i(){function t(t){this._root=t}return t.prototype=new BMap.Overlay,t.prototype.initialize=function(t){return t.getPanes().labelPane.appendChild(this._root),this._root},t.prototype.draw=function(){},t}function a(t,e){return t&&e&&t[0]===e[0]&&t[1]===e[1]}o.prototype.dimensions=["lng","lat"],o.prototype.setZoom=function(t){this._zoom=t},o.prototype.setCenter=function(t){this._center=this._projection.lngLatToPoint(new BMap.Point(t[0],t[1]))},o.prototype.setMapOffset=function(t){this._mapOffset=t},o.prototype.getBMap=function(){return this._bmap},o.prototype.dataToPoint=function(t){var e=new BMap.Point(t[0],t[1]),o=this._bmap.pointToOverlayPixel(e),n=this._mapOffset;return[o.x-n[0],o.y-n[1]]},o.prototype.pointToData=function(t){var e=this._mapOffset;return[(t=this._bmap.overlayPixelToPoint({x:t[0]+e[0],y:t[1]+e[1]})).lng,t.lat]},o.prototype.getViewRect=function(){var t=this._api;return new e.graphic.BoundingRect(0,0,t.getWidth(),t.getHeight())},o.prototype.getRoamTransform=function(){return e.matrix.create()},o.prototype.prepareCustoms=function(t){var o=this.getViewRect();return{coordSys:{type:"bmap",x:o.x,y:o.y,width:o.width,height:o.height},api:{coord:e.util.bind(this.dataToPoint,this),size:e.util.bind(n,this)}}};var r;o.dimensions=o.prototype.dimensions,o.create=function(t,e){var n,a=e.getDom();t.eachComponent("bmap",function(t){var p=e.getZr().painter,s=p.getViewportRoot();if("undefined"==typeof BMap)throw new Error("BMap api is not loaded");if(r=r||i(),n)throw new Error("Only one bmap component can exist");if(!t.__bmap){var m=a.querySelector(".ec-extension-bmap");m&&(s.style.left="0px",s.style.top="0px",a.removeChild(m)),(m=document.createElement("div")).style.cssText="width:100%;height:100%",m.classList.add("ec-extension-bmap"),a.appendChild(m);var c=t.__bmap=new BMap.Map(m),d=new r(s);c.addOverlay(d),p.getViewportRootOffset=function(){return{offsetLeft:0,offsetTop:0}}}var c=t.__bmap,f=t.get("center"),l=t.get("zoom");if(f&&l){var h=new BMap.Point(f[0],f[1]);c.centerAndZoom(h,l)}(n=new o(c,e)).setMapOffset(t.__mapOffset||[0,0]),n.setZoom(l),n.setCenter(f),t.coordinateSystem=n}),t.eachSeries(function(t){"bmap"===t.get("coordinateSystem")&&(t.coordinateSystem=n)})},e.extendComponentModel({type:"bmap",getBMap:function(){return this.__bmap},setCenterAndZoom:function(t,e){this.option.center=t,this.option.zoom=e},centerOrZoomChanged:function(t,e){var o=this.option;return!(a(t,o.center)&&e===o.zoom)},defaultOption:{center:[104.114129,37.550339],zoom:5,mapStyle:{},roam:!1}}),e.extendComponentView({type:"bmap",render:function(t,e,o){function n(){i||o.dispatchAction({type:"bmapRoam"})}var i=!0,a=t.getBMap(),r=o.getZr().painter.getViewportRoot(),p=t.coordinateSystem,s=function(e,n){if(!i){var a=r.parentNode.parentNode.parentNode,s=[-parseInt(a.style.left,10)||0,-parseInt(a.style.top,10)||0];r.style.left=s[0]+"px",r.style.top=s[1]+"px",p.setMapOffset(s),t.__mapOffset=s,o.dispatchAction({type:"bmapRoam"})}};a.removeEventListener("moving",this._oldMoveHandler),a.removeEventListener("zoomend",this._oldZoomEndHandler),a.addEventListener("moving",s),a.addEventListener("zoomend",n),this._oldMoveHandler=s,this._oldZoomEndHandler=n;var m=t.get("roam");m&&"scale"!==m?a.enableDragging():a.disableDragging(),m&&"move"!==m?(a.enableScrollWheelZoom(),a.enableDoubleClickZoom(),a.enablePinchToZoom()):(a.disableScrollWheelZoom(),a.disableDoubleClickZoom(),a.disablePinchToZoom());var c=t.__mapStyle,d=t.get("mapStyle")||{},f=JSON.stringify(d);JSON.stringify(c)!==f&&(Object.keys(d).length&&a.setMapStyle(d),t.__mapStyle=JSON.parse(f)),i=!1}}),e.registerCoordinateSystem("bmap",o),e.registerAction({type:"bmapRoam",event:"bmapRoam",update:"updateLayout"},function(t,e){e.eachComponent("bmap",function(t){var e=t.getBMap(),o=e.getCenter();t.setCenterAndZoom([o.lng,o.lat],e.getZoom())})});t.version="1.0.0"});
|
||||
@@ -0,0 +1,851 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('echarts')) :
|
||||
typeof define === 'function' && define.amd ? define(['exports', 'echarts'], factory) :
|
||||
(factory((global.dataTool = {}),global.echarts));
|
||||
}(this, (function (exports,echarts) { 'use strict';
|
||||
|
||||
/**
|
||||
* @module zrender/core/util
|
||||
*/
|
||||
|
||||
// 用于处理merge时无法遍历Date等对象的问题
|
||||
var arrayProto = Array.prototype;
|
||||
var nativeMap = arrayProto.map;
|
||||
|
||||
|
||||
/**
|
||||
* Those data types can be cloned:
|
||||
* Plain object, Array, TypedArray, number, string, null, undefined.
|
||||
* Those data types will be assgined using the orginal data:
|
||||
* BUILTIN_OBJECT
|
||||
* Instance of user defined class will be cloned to a plain object, without
|
||||
* properties in prototype.
|
||||
* Other data types is not supported (not sure what will happen).
|
||||
*
|
||||
* Caution: do not support clone Date, for performance consideration.
|
||||
* (There might be a large number of date in `series.data`).
|
||||
* So date should not be modified in and out of echarts.
|
||||
*
|
||||
* @param {*} source
|
||||
* @return {*} new
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {*} target
|
||||
* @param {*} source
|
||||
* @param {boolean} [overwrite=false]
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array} targetAndSources The first item is target, and the rests are source.
|
||||
* @param {boolean} [overwrite=false]
|
||||
* @return {*} target
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @param {*} target
|
||||
* @param {*} source
|
||||
* @memberOf module:zrender/core/util
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @param {*} target
|
||||
* @param {*} source
|
||||
* @param {boolean} [overlay=false]
|
||||
* @memberOf module:zrender/core/util
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询数组中元素的index
|
||||
* @memberOf module:zrender/core/util
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 构造类继承关系
|
||||
*
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {Function} clazz 源类
|
||||
* @param {Function} baseClazz 基类
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {Object|Function} target
|
||||
* @param {Object|Function} sorce
|
||||
* @param {boolean} overlay
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Consider typed array.
|
||||
* @param {Array|TypedArray} data
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 数组或对象遍历
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {Object|Array} obj
|
||||
* @param {Function} cb
|
||||
* @param {*} [context]
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 数组映射
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {Array} obj
|
||||
* @param {Function} cb
|
||||
* @param {*} [context]
|
||||
* @return {Array}
|
||||
*/
|
||||
function map(obj, cb, context) {
|
||||
if (!(obj && cb)) {
|
||||
return;
|
||||
}
|
||||
if (obj.map && obj.map === nativeMap) {
|
||||
return obj.map(cb, context);
|
||||
}
|
||||
else {
|
||||
var result = [];
|
||||
for (var i = 0, len = obj.length; i < len; i++) {
|
||||
result.push(cb.call(context, obj[i], i, obj));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {Array} obj
|
||||
* @param {Function} cb
|
||||
* @param {Object} [memo]
|
||||
* @param {*} [context]
|
||||
* @return {Array}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 数组过滤
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {Array} obj
|
||||
* @param {Function} cb
|
||||
* @param {*} [context]
|
||||
* @return {Array}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 数组项查找
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {Array} obj
|
||||
* @param {Function} cb
|
||||
* @param {*} [context]
|
||||
* @return {*}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {Function} func
|
||||
* @param {*} context
|
||||
* @return {Function}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {Function} func
|
||||
* @return {Function}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {*} value
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {*} value
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {*} value
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {*} value
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {*} value
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {*} value
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {*} value
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Whether is exactly NaN. Notice isNaN('a') returns true.
|
||||
* @param {*} value
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* If value1 is not null, then return value1, otherwise judget rest of values.
|
||||
* Low performance.
|
||||
* @memberOf module:zrender/core/util
|
||||
* @return {*} Final value
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {Array} arr
|
||||
* @param {number} startIndex
|
||||
* @param {number} endIndex
|
||||
* @return {Array}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Normalize css liked array configuration
|
||||
* e.g.
|
||||
* 3 => [3, 3, 3, 3]
|
||||
* [4, 2] => [4, 2, 4, 2]
|
||||
* [4, 3, 2] => [4, 3, 2, 3]
|
||||
* @param {number|Array.<number>} val
|
||||
* @return {Array.<number>}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {boolean} condition
|
||||
* @param {string} message
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @memberOf module:zrender/core/util
|
||||
* @param {string} str string to be trimed
|
||||
* @return {string} trimed string
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Set an object as primitive to be ignored traversing children in clone or merge
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// GEXF File Parser
|
||||
// http://gexf.net/1.2draft/gexf-12draft-primer.pdf
|
||||
|
||||
function parse(xml) {
|
||||
var doc;
|
||||
if (typeof xml === 'string') {
|
||||
var parser = new DOMParser();
|
||||
doc = parser.parseFromString(xml, 'text/xml');
|
||||
}
|
||||
else {
|
||||
doc = xml;
|
||||
}
|
||||
if (!doc || doc.getElementsByTagName('parsererror').length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var gexfRoot = getChildByTagName(doc, 'gexf');
|
||||
|
||||
if (!gexfRoot) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var graphRoot = getChildByTagName(gexfRoot, 'graph');
|
||||
|
||||
var attributes = parseAttributes(getChildByTagName(graphRoot, 'attributes'));
|
||||
var attributesMap = {};
|
||||
for (var i = 0; i < attributes.length; i++) {
|
||||
attributesMap[attributes[i].id] = attributes[i];
|
||||
}
|
||||
|
||||
return {
|
||||
nodes: parseNodes(getChildByTagName(graphRoot, 'nodes'), attributesMap),
|
||||
links: parseEdges(getChildByTagName(graphRoot, 'edges'))
|
||||
};
|
||||
}
|
||||
|
||||
function parseAttributes(parent) {
|
||||
return parent ? map(getChildrenByTagName(parent, 'attribute'), function (attribDom) {
|
||||
return {
|
||||
id: getAttr(attribDom, 'id'),
|
||||
title: getAttr(attribDom, 'title'),
|
||||
type: getAttr(attribDom, 'type')
|
||||
};
|
||||
}) : [];
|
||||
}
|
||||
|
||||
function parseNodes(parent, attributesMap) {
|
||||
return parent ? map(getChildrenByTagName(parent, 'node'), function (nodeDom) {
|
||||
|
||||
var id = getAttr(nodeDom, 'id');
|
||||
var label = getAttr(nodeDom, 'label');
|
||||
|
||||
var node = {
|
||||
id: id,
|
||||
name: label,
|
||||
itemStyle: {
|
||||
normal: {}
|
||||
}
|
||||
};
|
||||
|
||||
var vizSizeDom = getChildByTagName(nodeDom, 'viz:size');
|
||||
var vizPosDom = getChildByTagName(nodeDom, 'viz:position');
|
||||
var vizColorDom = getChildByTagName(nodeDom, 'viz:color');
|
||||
// var vizShapeDom = getChildByTagName(nodeDom, 'viz:shape');
|
||||
|
||||
var attvaluesDom = getChildByTagName(nodeDom, 'attvalues');
|
||||
|
||||
if (vizSizeDom) {
|
||||
node.symbolSize = parseFloat(getAttr(vizSizeDom, 'value'));
|
||||
}
|
||||
if (vizPosDom) {
|
||||
node.x = parseFloat(getAttr(vizPosDom, 'x'));
|
||||
node.y = parseFloat(getAttr(vizPosDom, 'y'));
|
||||
// z
|
||||
}
|
||||
if (vizColorDom) {
|
||||
node.itemStyle.normal.color = 'rgb(' +[
|
||||
getAttr(vizColorDom, 'r') | 0,
|
||||
getAttr(vizColorDom, 'g') | 0,
|
||||
getAttr(vizColorDom, 'b') | 0
|
||||
].join(',') + ')';
|
||||
}
|
||||
// if (vizShapeDom) {
|
||||
// node.shape = getAttr(vizShapeDom, 'shape');
|
||||
// }
|
||||
if (attvaluesDom) {
|
||||
var attvalueDomList = getChildrenByTagName(attvaluesDom, 'attvalue');
|
||||
|
||||
node.attributes = {};
|
||||
|
||||
for (var j = 0; j < attvalueDomList.length; j++) {
|
||||
var attvalueDom = attvalueDomList[j];
|
||||
var attId = getAttr(attvalueDom, 'for');
|
||||
var attValue = getAttr(attvalueDom, 'value');
|
||||
var attribute = attributesMap[attId];
|
||||
|
||||
if (attribute) {
|
||||
switch (attribute.type) {
|
||||
case 'integer':
|
||||
case 'long':
|
||||
attValue = parseInt(attValue, 10);
|
||||
break;
|
||||
case 'float':
|
||||
case 'double':
|
||||
attValue = parseFloat(attValue);
|
||||
break;
|
||||
case 'boolean':
|
||||
attValue = attValue.toLowerCase() == 'true';
|
||||
break;
|
||||
default:
|
||||
}
|
||||
node.attributes[attId] = attValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}) : [];
|
||||
}
|
||||
|
||||
function parseEdges(parent) {
|
||||
return parent ? map(getChildrenByTagName(parent, 'edge'), function (edgeDom) {
|
||||
var id = getAttr(edgeDom, 'id');
|
||||
var label = getAttr(edgeDom, 'label');
|
||||
|
||||
var sourceId = getAttr(edgeDom, 'source');
|
||||
var targetId = getAttr(edgeDom, 'target');
|
||||
|
||||
var edge = {
|
||||
id: id,
|
||||
name: label,
|
||||
source: sourceId,
|
||||
target: targetId,
|
||||
lineStyle: {
|
||||
normal: {}
|
||||
}
|
||||
};
|
||||
|
||||
var lineStyle = edge.lineStyle.normal;
|
||||
|
||||
var vizThicknessDom = getChildByTagName(edgeDom, 'viz:thickness');
|
||||
var vizColorDom = getChildByTagName(edgeDom, 'viz:color');
|
||||
// var vizShapeDom = getChildByTagName(edgeDom, 'viz:shape');
|
||||
|
||||
if (vizThicknessDom) {
|
||||
lineStyle.width = parseFloat(vizThicknessDom.getAttribute('value'));
|
||||
}
|
||||
if (vizColorDom) {
|
||||
lineStyle.color = 'rgb(' + [
|
||||
getAttr(vizColorDom, 'r') | 0,
|
||||
getAttr(vizColorDom, 'g') | 0,
|
||||
getAttr(vizColorDom, 'b') | 0
|
||||
].join(',') + ')';
|
||||
}
|
||||
// if (vizShapeDom) {
|
||||
// edge.shape = vizShapeDom.getAttribute('shape');
|
||||
// }
|
||||
|
||||
return edge;
|
||||
}) : [];
|
||||
}
|
||||
|
||||
function getAttr(el, attrName) {
|
||||
return el.getAttribute(attrName);
|
||||
}
|
||||
|
||||
function getChildByTagName (parent, tagName) {
|
||||
var node = parent.firstChild;
|
||||
|
||||
while (node) {
|
||||
if (
|
||||
node.nodeType != 1 ||
|
||||
node.nodeName.toLowerCase() != tagName.toLowerCase()
|
||||
) {
|
||||
node = node.nextSibling;
|
||||
} else {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function getChildrenByTagName (parent, tagName) {
|
||||
var node = parent.firstChild;
|
||||
var children = [];
|
||||
while (node) {
|
||||
if (node.nodeName.toLowerCase() == tagName.toLowerCase()) {
|
||||
children.push(node);
|
||||
}
|
||||
node = node.nextSibling;
|
||||
}
|
||||
|
||||
return children;
|
||||
}
|
||||
|
||||
|
||||
var gexf = (Object.freeze || Object)({
|
||||
parse: parse
|
||||
});
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A third-party license is embeded for some of the code in this file:
|
||||
* The method "quantile" was copied from "d3.js".
|
||||
* (See more details in the comment of the method below.)
|
||||
* The use of the source code of this file is also subject to the terms
|
||||
* and consitions of the license of "d3.js" (BSD-3Clause, see
|
||||
* </licenses/LICENSE-d3>).
|
||||
*/
|
||||
|
||||
/**
|
||||
* Linear mapping a value from domain to range
|
||||
* @memberOf module:echarts/util/number
|
||||
* @param {(number|Array.<number>)} val
|
||||
* @param {Array.<number>} domain Domain extent domain[0] can be bigger than domain[1]
|
||||
* @param {Array.<number>} range Range extent range[0] can be bigger than range[1]
|
||||
* @param {boolean} clamp
|
||||
* @return {(number|Array.<number>}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Convert a percent string to absolute number.
|
||||
* Returns NaN if percent is not a valid string or number
|
||||
* @memberOf module:echarts/util/number
|
||||
* @param {string|number} percent
|
||||
* @param {number} all
|
||||
* @return {number}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* (1) Fix rounding error of float numbers.
|
||||
* (2) Support return string to avoid scientific notation like '3.5e-7'.
|
||||
*
|
||||
* @param {number} x
|
||||
* @param {number} [precision]
|
||||
* @param {boolean} [returnStr]
|
||||
* @return {number|string}
|
||||
*/
|
||||
|
||||
|
||||
function asc(arr) {
|
||||
arr.sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get precision
|
||||
* @param {number} val
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @param {string|number} val
|
||||
* @return {number}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Minimal dicernible data precisioin according to a single pixel.
|
||||
*
|
||||
* @param {Array.<number>} dataExtent
|
||||
* @param {Array.<number>} pixelExtent
|
||||
* @return {number} precision
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Get a data of given precision, assuring the sum of percentages
|
||||
* in valueList is 1.
|
||||
* The largest remainer method is used.
|
||||
* https://en.wikipedia.org/wiki/Largest_remainder_method
|
||||
*
|
||||
* @param {Array.<number>} valueList a list of all data
|
||||
* @param {number} idx index of the data to be processed in valueList
|
||||
* @param {number} precision integer number showing digits of precision
|
||||
* @return {number} percent ranging from 0 to 100
|
||||
*/
|
||||
|
||||
|
||||
// Number.MAX_SAFE_INTEGER, ie do not support.
|
||||
|
||||
|
||||
/**
|
||||
* To 0 - 2 * PI, considering negative radian.
|
||||
* @param {number} radian
|
||||
* @return {number}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @param {type} radian
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
||||
|
||||
/* eslint-enable */
|
||||
|
||||
/**
|
||||
* @param {string|Date|number} value These values can be accepted:
|
||||
* + An instance of Date, represent a time in its own time zone.
|
||||
* + Or string in a subset of ISO 8601, only including:
|
||||
* + only year, month, date: '2012-03', '2012-03-01', '2012-03-01 05', '2012-03-01 05:06',
|
||||
* + separated with T or space: '2012-03-01T12:22:33.123', '2012-03-01 12:22:33.123',
|
||||
* + time zone: '2012-03-01T12:22:33Z', '2012-03-01T12:22:33+8000', '2012-03-01T12:22:33-05:00',
|
||||
* all of which will be treated as local time if time zone is not specified
|
||||
* (see <https://momentjs.com/>).
|
||||
* + Or other string format, including (all of which will be treated as loacal time):
|
||||
* '2012', '2012-3-1', '2012/3/1', '2012/03/01',
|
||||
* '2009/6/12 2:00', '2009/6/12 2:05:08', '2009/6/12 2:05:08.123'
|
||||
* + a timestamp, which represent a time in UTC.
|
||||
* @return {Date} date
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Quantity of a number. e.g. 0.1, 1, 10, 100
|
||||
*
|
||||
* @param {number} val
|
||||
* @return {number}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* find a “nice” number approximately equal to x. Round the number if round = true,
|
||||
* take ceiling if round = false. The primary observation is that the “nicest”
|
||||
* numbers in decimal are 1, 2, and 5, and all power-of-ten multiples of these numbers.
|
||||
*
|
||||
* See "Nice Numbers for Graph Labels" of Graphic Gems.
|
||||
*
|
||||
* @param {number} val Non-negative value.
|
||||
* @param {boolean} round
|
||||
* @return {number}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* This code was copied from "d3.js"
|
||||
* <https://github.com/d3/d3/blob/9cc9a875e636a1dcf36cc1e07bdf77e1ad6e2c74/src/arrays/quantile.js>.
|
||||
* See the license statement at the head of this file.
|
||||
* @param {Array.<number>} ascArr
|
||||
*/
|
||||
function quantile(ascArr, p) {
|
||||
var H = (ascArr.length - 1) * p + 1;
|
||||
var h = Math.floor(H);
|
||||
var v = +ascArr[h - 1];
|
||||
var e = H - h;
|
||||
return e ? v + e * (ascArr[h] - v) : v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Order intervals asc, and split them when overlap.
|
||||
* expect(numberUtil.reformIntervals([
|
||||
* {interval: [18, 62], close: [1, 1]},
|
||||
* {interval: [-Infinity, -70], close: [0, 0]},
|
||||
* {interval: [-70, -26], close: [1, 1]},
|
||||
* {interval: [-26, 18], close: [1, 1]},
|
||||
* {interval: [62, 150], close: [1, 1]},
|
||||
* {interval: [106, 150], close: [1, 1]},
|
||||
* {interval: [150, Infinity], close: [0, 0]}
|
||||
* ])).toEqual([
|
||||
* {interval: [-Infinity, -70], close: [0, 0]},
|
||||
* {interval: [-70, -26], close: [1, 1]},
|
||||
* {interval: [-26, 18], close: [0, 1]},
|
||||
* {interval: [18, 62], close: [0, 1]},
|
||||
* {interval: [62, 150], close: [0, 1]},
|
||||
* {interval: [150, Infinity], close: [0, 0]}
|
||||
* ]);
|
||||
* @param {Array.<Object>} list, where `close` mean open or close
|
||||
* of the interval, and Infinity can be used.
|
||||
* @return {Array.<Object>} The origin list, which has been reformed.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* parseFloat NaNs numeric-cast false positives (null|true|false|"")
|
||||
* ...but misinterprets leading-number strings, particularly hex literals ("0x...")
|
||||
* subtraction forces infinities to NaN
|
||||
*
|
||||
* @param {*} v
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* See:
|
||||
* <https://en.wikipedia.org/wiki/Box_plot#cite_note-frigge_hoaglin_iglewicz-2>
|
||||
* <http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/boxplot.stats.html>
|
||||
*
|
||||
* Helper method for preparing data.
|
||||
*
|
||||
* @param {Array.<number>} rawData like
|
||||
* [
|
||||
* [12,232,443], (raw data set for the first box)
|
||||
* [3843,5545,1232], (raw datat set for the second box)
|
||||
* ...
|
||||
* ]
|
||||
* @param {Object} [opt]
|
||||
*
|
||||
* @param {(number|string)} [opt.boundIQR=1.5] Data less than min bound is outlier.
|
||||
* default 1.5, means Q1 - 1.5 * (Q3 - Q1).
|
||||
* If 'none'/0 passed, min bound will not be used.
|
||||
* @param {(number|string)} [opt.layout='horizontal']
|
||||
* Box plot layout, can be 'horizontal' or 'vertical'
|
||||
* @return {Object} {
|
||||
* boxData: Array.<Array.<number>>
|
||||
* outliers: Array.<Array.<number>>
|
||||
* axisData: Array.<string>
|
||||
* }
|
||||
*/
|
||||
var prepareBoxplotData = function (rawData, opt) {
|
||||
opt = opt || [];
|
||||
var boxData = [];
|
||||
var outliers = [];
|
||||
var axisData = [];
|
||||
var boundIQR = opt.boundIQR;
|
||||
var useExtreme = boundIQR === 'none' || boundIQR === 0;
|
||||
|
||||
for (var i = 0; i < rawData.length; i++) {
|
||||
axisData.push(i + '');
|
||||
var ascList = asc(rawData[i].slice());
|
||||
|
||||
var Q1 = quantile(ascList, 0.25);
|
||||
var Q2 = quantile(ascList, 0.5);
|
||||
var Q3 = quantile(ascList, 0.75);
|
||||
var min = ascList[0];
|
||||
var max = ascList[ascList.length - 1];
|
||||
|
||||
var bound = (boundIQR == null ? 1.5 : boundIQR) * (Q3 - Q1);
|
||||
|
||||
var low = useExtreme
|
||||
? min
|
||||
: Math.max(min, Q1 - bound);
|
||||
var high = useExtreme
|
||||
? max
|
||||
: Math.min(max, Q3 + bound);
|
||||
|
||||
boxData.push([low, Q1, Q2, Q3, high]);
|
||||
|
||||
for (var j = 0; j < ascList.length; j++) {
|
||||
var dataItem = ascList[j];
|
||||
if (dataItem < low || dataItem > high) {
|
||||
var outlier = [i, dataItem];
|
||||
opt.layout === 'vertical' && outlier.reverse();
|
||||
outliers.push(outlier);
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
boxData: boxData,
|
||||
outliers: outliers,
|
||||
axisData: axisData
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
var version = '1.0.0';
|
||||
|
||||
// For backward compatibility, where the namespace `dataTool` will
|
||||
// be mounted on `echarts` is the extension `dataTool` is imported.
|
||||
// But the old version of echarts do not have `dataTool` namespace,
|
||||
// so check it before mounting.
|
||||
if (echarts.dataTool) {
|
||||
echarts.dataTool.version = version;
|
||||
echarts.dataTool.gexf = gexf;
|
||||
echarts.dataTool.prepareBoxplotData = prepareBoxplotData;
|
||||
}
|
||||
|
||||
exports.version = version;
|
||||
exports.gexf = gexf;
|
||||
exports.prepareBoxplotData = prepareBoxplotData;
|
||||
|
||||
})));
|
||||
//# sourceMappingURL=dataTool.js.map
|
||||
22
source/vue/exam-admin/public/admin/components/echarts/extension/dataTool.min.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],t):t(e.dataTool={},e.echarts)}(this,function(e,t){"use strict";function r(e,t,r){if(e&&t){if(e.map&&e.map===c)return e.map(t,r);for(var a=[],n=0,o=e.length;n<o;n++)a.push(t.call(r,e[n],n,e));return a}}function a(e){return e?r(u(e,"attribute"),function(e){return{id:i(e,"id"),title:i(e,"title"),type:i(e,"type")}}):[]}function n(e,t){return e?r(u(e,"node"),function(e){var r={id:i(e,"id"),name:i(e,"label"),itemStyle:{normal:{}}},a=l(e,"viz:size"),n=l(e,"viz:position"),o=l(e,"viz:color"),s=l(e,"attvalues");if(a&&(r.symbolSize=parseFloat(i(a,"value"))),n&&(r.x=parseFloat(i(n,"x")),r.y=parseFloat(i(n,"y"))),o&&(r.itemStyle.normal.color="rgb("+[0|i(o,"r"),0|i(o,"g"),0|i(o,"b")].join(",")+")"),s){var f=u(s,"attvalue");r.attributes={};for(var c=0;c<f.length;c++){var p=f[c],d=i(p,"for"),v=i(p,"value"),g=t[d];if(g){switch(g.type){case"integer":case"long":v=parseInt(v,10);break;case"float":case"double":v=parseFloat(v);break;case"boolean":v="true"==v.toLowerCase()}r.attributes[d]=v}}}return r}):[]}function o(e){return e?r(u(e,"edge"),function(e){var t={id:i(e,"id"),name:i(e,"label"),source:i(e,"source"),target:i(e,"target"),lineStyle:{normal:{}}},r=t.lineStyle.normal,a=l(e,"viz:thickness"),n=l(e,"viz:color");return a&&(r.width=parseFloat(a.getAttribute("value"))),n&&(r.color="rgb("+[0|i(n,"r"),0|i(n,"g"),0|i(n,"b")].join(",")+")"),t}):[]}function i(e,t){return e.getAttribute(t)}function l(e,t){for(var r=e.firstChild;r;){if(1==r.nodeType&&r.nodeName.toLowerCase()==t.toLowerCase())return r;r=r.nextSibling}return null}function u(e,t){for(var r=e.firstChild,a=[];r;)r.nodeName.toLowerCase()==t.toLowerCase()&&a.push(r),r=r.nextSibling;return a}function s(e){return e.sort(function(e,t){return e-t}),e}function f(e,t){var r=(e.length-1)*t+1,a=Math.floor(r),n=+e[a-1],o=r-a;return o?n+o*(e[a]-n):n}var c=Array.prototype.map,p=(Object.freeze||Object)({parse:function(e){var t;if(!(t="string"==typeof e?(new DOMParser).parseFromString(e,"text/xml"):e)||t.getElementsByTagName("parsererror").length)return null;var r=l(t,"gexf");if(!r)return null;for(var i=l(r,"graph"),u=a(l(i,"attributes")),s={},f=0;f<u.length;f++)s[u[f].id]=u[f];return{nodes:n(l(i,"nodes"),s),links:o(l(i,"edges"))}}}),d=function(e,t){for(var r=[],a=[],n=[],o=(t=t||[]).boundIQR,i="none"===o||0===o,l=0;l<e.length;l++){n.push(l+"");var u=s(e[l].slice()),c=f(u,.25),p=f(u,.5),d=f(u,.75),v=u[0],g=u[u.length-1],h=(null==o?1.5:o)*(d-c),b=i?v:Math.max(v,c-h),m=i?g:Math.min(g,d+h);r.push([b,c,p,d,m]);for(var y=0;y<u.length;y++){var x=u[y];if(x<b||x>m){var w=[l,x];"vertical"===t.layout&&w.reverse(),a.push(w)}}}return{boxData:r,outliers:a,axisData:n}};t.dataTool&&(t.dataTool.version="1.0.0",t.dataTool.gexf=p,t.dataTool.prepareBoxplotData=d),e.version="1.0.0",e.gexf=p,e.prepareBoxplotData=d});
|
||||
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
(function (root, factory) {
|
||||
/* eslint-disable */
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['exports', 'echarts'], factory);
|
||||
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
|
||||
// CommonJS
|
||||
factory(exports, require('echarts'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory({}, root.echarts);
|
||||
}
|
||||
/* eslint-enable */
|
||||
}(this, function (exports, echarts) {
|
||||
var log = function (msg) {
|
||||
if (typeof console !== 'undefined') {
|
||||
console && console.error && console.error(msg);
|
||||
}
|
||||
};
|
||||
if (!echarts) {
|
||||
log('ECharts is not Loaded');
|
||||
return;
|
||||
}
|
||||
var contrastColor = '#eee';
|
||||
var axisCommon = function () {
|
||||
return {
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: contrastColor
|
||||
}
|
||||
},
|
||||
axisTick: {
|
||||
lineStyle: {
|
||||
color: contrastColor
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
textStyle: {
|
||||
color: contrastColor
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
type: 'dashed',
|
||||
color: '#aaa'
|
||||
}
|
||||
},
|
||||
splitArea: {
|
||||
areaStyle: {
|
||||
color: contrastColor
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var colorPalette = [
|
||||
'#dd6b66', '#759aa0', '#e69d87', '#8dc1a9', '#ea7e53',
|
||||
'#eedd78', '#73a373', '#73b9bc', '#7289ab', '#91ca8c', '#f49f42'
|
||||
];
|
||||
var theme = {
|
||||
color: colorPalette,
|
||||
backgroundColor: '#333',
|
||||
tooltip: {
|
||||
axisPointer: {
|
||||
lineStyle: {
|
||||
color: contrastColor
|
||||
},
|
||||
crossStyle: {
|
||||
color: contrastColor
|
||||
}
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
textStyle: {
|
||||
color: contrastColor
|
||||
}
|
||||
},
|
||||
textStyle: {
|
||||
color: contrastColor
|
||||
},
|
||||
title: {
|
||||
textStyle: {
|
||||
color: contrastColor
|
||||
}
|
||||
},
|
||||
toolbox: {
|
||||
iconStyle: {
|
||||
normal: {
|
||||
borderColor: contrastColor
|
||||
}
|
||||
}
|
||||
},
|
||||
dataZoom: {
|
||||
textStyle: {
|
||||
color: contrastColor
|
||||
}
|
||||
},
|
||||
visualMap: {
|
||||
textStyle: {
|
||||
color: contrastColor
|
||||
}
|
||||
},
|
||||
timeline: {
|
||||
lineStyle: {
|
||||
color: contrastColor
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: colorPalette[1]
|
||||
}
|
||||
},
|
||||
label: {
|
||||
normal: {
|
||||
textStyle: {
|
||||
color: contrastColor
|
||||
}
|
||||
}
|
||||
},
|
||||
controlStyle: {
|
||||
normal: {
|
||||
color: contrastColor,
|
||||
borderColor: contrastColor
|
||||
}
|
||||
}
|
||||
},
|
||||
timeAxis: axisCommon(),
|
||||
logAxis: axisCommon(),
|
||||
valueAxis: axisCommon(),
|
||||
categoryAxis: axisCommon(),
|
||||
|
||||
line: {
|
||||
symbol: 'circle'
|
||||
},
|
||||
graph: {
|
||||
color: colorPalette
|
||||
},
|
||||
gauge: {
|
||||
title: {
|
||||
textStyle: {
|
||||
color: contrastColor
|
||||
}
|
||||
}
|
||||
},
|
||||
candlestick: {
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#FD1050',
|
||||
color0: '#0CF49B',
|
||||
borderColor: '#FD1050',
|
||||
borderColor0: '#0CF49B'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
theme.categoryAxis.splitLine.show = false;
|
||||
echarts.registerTheme('dark', theme);
|
||||
}));
|
||||
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
(function (root, factory) {if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['exports', 'echarts'], factory);
|
||||
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
|
||||
// CommonJS
|
||||
factory(exports, require('echarts'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory({}, root.echarts);
|
||||
}
|
||||
}(this, function (exports, echarts) {
|
||||
var log = function (msg) {
|
||||
if (typeof console !== 'undefined') {
|
||||
console && console.error && console.error(msg);
|
||||
}
|
||||
};
|
||||
if (!echarts) {
|
||||
log('ECharts is not Loaded');
|
||||
return;
|
||||
}
|
||||
|
||||
var colorPalette = [
|
||||
'#C1232B','#27727B','#FCCE10','#E87C25','#B5C334',
|
||||
'#FE8463','#9BCA63','#FAD860','#F3A43B','#60C0DD',
|
||||
'#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0'
|
||||
];
|
||||
|
||||
var theme = {
|
||||
|
||||
color: colorPalette,
|
||||
|
||||
title: {
|
||||
textStyle: {
|
||||
fontWeight: 'normal',
|
||||
color: '#27727B'
|
||||
}
|
||||
},
|
||||
|
||||
visualMap: {
|
||||
color:['#C1232B','#FCCE10']
|
||||
},
|
||||
|
||||
toolbox: {
|
||||
iconStyle: {
|
||||
normal: {
|
||||
borderColor: colorPalette[0]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
tooltip: {
|
||||
backgroundColor: 'rgba(50,50,50,0.5)',
|
||||
axisPointer : {
|
||||
type : 'line',
|
||||
lineStyle : {
|
||||
color: '#27727B',
|
||||
type: 'dashed'
|
||||
},
|
||||
crossStyle: {
|
||||
color: '#27727B'
|
||||
},
|
||||
shadowStyle : {
|
||||
color: 'rgba(200,200,200,0.3)'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
dataZoom: {
|
||||
dataBackgroundColor: 'rgba(181,195,52,0.3)',
|
||||
fillerColor: 'rgba(181,195,52,0.2)',
|
||||
handleColor: '#27727B'
|
||||
},
|
||||
|
||||
categoryAxis: {
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#27727B'
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
|
||||
valueAxis: {
|
||||
axisLine: {
|
||||
show: false
|
||||
},
|
||||
splitArea : {
|
||||
show: false
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: ['#ccc'],
|
||||
type: 'dashed'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
timeline: {
|
||||
lineStyle: {
|
||||
color: '#27727B'
|
||||
},
|
||||
controlStyle: {
|
||||
normal: {
|
||||
color: '#27727B',
|
||||
borderColor: '#27727B'
|
||||
}
|
||||
},
|
||||
symbol: 'emptyCircle',
|
||||
symbolSize: 3
|
||||
},
|
||||
|
||||
line: {
|
||||
itemStyle: {
|
||||
normal: {
|
||||
borderWidth:2,
|
||||
borderColor:'#fff',
|
||||
lineStyle: {
|
||||
width: 3
|
||||
}
|
||||
},
|
||||
emphasis: {
|
||||
borderWidth:0
|
||||
}
|
||||
},
|
||||
symbol: 'circle',
|
||||
symbolSize: 3.5
|
||||
},
|
||||
|
||||
candlestick: {
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#C1232B',
|
||||
color0: '#B5C334',
|
||||
lineStyle: {
|
||||
width: 1,
|
||||
color: '#C1232B',
|
||||
color0: '#B5C334'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
graph: {
|
||||
color: colorPalette
|
||||
},
|
||||
|
||||
map: {
|
||||
label: {
|
||||
normal: {
|
||||
textStyle: {
|
||||
color: '#C1232B'
|
||||
}
|
||||
},
|
||||
emphasis: {
|
||||
textStyle: {
|
||||
color: 'rgb(100,0,0)'
|
||||
}
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
areaColor: '#ddd',
|
||||
borderColor: '#eee'
|
||||
},
|
||||
emphasis: {
|
||||
areaColor: '#fe994e'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
gauge: {
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: [[0.2, '#B5C334'],[0.8, '#27727B'],[1, '#C1232B']]
|
||||
}
|
||||
},
|
||||
axisTick: {
|
||||
splitNumber: 2,
|
||||
length: 5,
|
||||
lineStyle: {
|
||||
color: '#fff'
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
textStyle: {
|
||||
color: '#fff'
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
length: '5%',
|
||||
lineStyle: {
|
||||
color: '#fff'
|
||||
}
|
||||
},
|
||||
title : {
|
||||
offsetCenter: [0, -20]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
echarts.registerTheme('infographic', theme);
|
||||
}));
|
||||
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['exports', 'echarts'], factory);
|
||||
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
|
||||
// CommonJS
|
||||
factory(exports, require('echarts'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory({}, root.echarts);
|
||||
}
|
||||
}(this, function (exports, echarts) {
|
||||
var log = function (msg) {
|
||||
if (typeof console !== 'undefined') {
|
||||
console && console.error && console.error(msg);
|
||||
}
|
||||
};
|
||||
if (!echarts) {
|
||||
log('ECharts is not Loaded');
|
||||
return;
|
||||
}
|
||||
|
||||
var colorPalette = [
|
||||
'#2ec7c9','#b6a2de','#5ab1ef','#ffb980','#d87a80',
|
||||
'#8d98b3','#e5cf0d','#97b552','#95706d','#dc69aa',
|
||||
'#07a2a4','#9a7fd1','#588dd5','#f5994e','#c05050',
|
||||
'#59678c','#c9ab00','#7eb00a','#6f5553','#c14089'
|
||||
];
|
||||
|
||||
|
||||
var theme = {
|
||||
color: colorPalette,
|
||||
|
||||
title: {
|
||||
textStyle: {
|
||||
fontWeight: 'normal',
|
||||
color: '#008acd'
|
||||
}
|
||||
},
|
||||
|
||||
visualMap: {
|
||||
itemWidth: 15,
|
||||
color: ['#5ab1ef','#e0ffff']
|
||||
},
|
||||
|
||||
toolbox: {
|
||||
iconStyle: {
|
||||
normal: {
|
||||
borderColor: colorPalette[0]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
tooltip: {
|
||||
backgroundColor: 'rgba(50,50,50,0.5)',
|
||||
axisPointer : {
|
||||
type : 'line',
|
||||
lineStyle : {
|
||||
color: '#008acd'
|
||||
},
|
||||
crossStyle: {
|
||||
color: '#008acd'
|
||||
},
|
||||
shadowStyle : {
|
||||
color: 'rgba(200,200,200,0.2)'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
dataZoom: {
|
||||
dataBackgroundColor: '#efefff',
|
||||
fillerColor: 'rgba(182,162,222,0.2)',
|
||||
handleColor: '#008acd'
|
||||
},
|
||||
|
||||
grid: {
|
||||
borderColor: '#eee'
|
||||
},
|
||||
|
||||
categoryAxis: {
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#008acd'
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: ['#eee']
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
valueAxis: {
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#008acd'
|
||||
}
|
||||
},
|
||||
splitArea : {
|
||||
show : true,
|
||||
areaStyle : {
|
||||
color: ['rgba(250,250,250,0.1)','rgba(200,200,200,0.1)']
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: ['#eee']
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
timeline : {
|
||||
lineStyle : {
|
||||
color : '#008acd'
|
||||
},
|
||||
controlStyle : {
|
||||
normal : { color : '#008acd'},
|
||||
emphasis : { color : '#008acd'}
|
||||
},
|
||||
symbol : 'emptyCircle',
|
||||
symbolSize : 3
|
||||
},
|
||||
|
||||
line: {
|
||||
smooth : true,
|
||||
symbol: 'emptyCircle',
|
||||
symbolSize: 3
|
||||
},
|
||||
|
||||
candlestick: {
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#d87a80',
|
||||
color0: '#2ec7c9',
|
||||
lineStyle: {
|
||||
color: '#d87a80',
|
||||
color0: '#2ec7c9'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
scatter: {
|
||||
symbol: 'circle',
|
||||
symbolSize: 4
|
||||
},
|
||||
|
||||
map: {
|
||||
label: {
|
||||
normal: {
|
||||
textStyle: {
|
||||
color: '#d87a80'
|
||||
}
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
borderColor: '#eee',
|
||||
areaColor: '#ddd'
|
||||
},
|
||||
emphasis: {
|
||||
areaColor: '#fe994e'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
graph: {
|
||||
color: colorPalette
|
||||
},
|
||||
|
||||
gauge : {
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: [[0.2, '#2ec7c9'],[0.8, '#5ab1ef'],[1, '#d87a80']],
|
||||
width: 10
|
||||
}
|
||||
},
|
||||
axisTick: {
|
||||
splitNumber: 10,
|
||||
length :15,
|
||||
lineStyle: {
|
||||
color: 'auto'
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
length :22,
|
||||
lineStyle: {
|
||||
color: 'auto'
|
||||
}
|
||||
},
|
||||
pointer : {
|
||||
width : 5
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
echarts.registerTheme('macarons', theme);
|
||||
}));
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
(function (root, factory) {if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['exports', 'echarts'], factory);
|
||||
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
|
||||
// CommonJS
|
||||
factory(exports, require('echarts'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory({}, root.echarts);
|
||||
}
|
||||
}(this, function (exports, echarts) {
|
||||
var log = function (msg) {
|
||||
if (typeof console !== 'undefined') {
|
||||
console && console.error && console.error(msg);
|
||||
}
|
||||
};
|
||||
if (!echarts) {
|
||||
log('ECharts is not Loaded');
|
||||
return;
|
||||
}
|
||||
|
||||
var colorPalette = ['#E01F54','#001852','#f5e8c8','#b8d2c7','#c6b38e',
|
||||
'#a4d8c2','#f3d999','#d3758f','#dcc392','#2e4783',
|
||||
'#82b6e9','#ff6347','#a092f1','#0a915d','#eaf889',
|
||||
'#6699FF','#ff6666','#3cb371','#d5b158','#38b6b6'
|
||||
];
|
||||
|
||||
var theme = {
|
||||
color: colorPalette,
|
||||
|
||||
visualMap: {
|
||||
color:['#e01f54','#e7dbc3'],
|
||||
textStyle: {
|
||||
color: '#333'
|
||||
}
|
||||
},
|
||||
|
||||
candlestick: {
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#e01f54',
|
||||
color0: '#001852',
|
||||
lineStyle: {
|
||||
width: 1,
|
||||
color: '#f5e8c8',
|
||||
color0: '#b8d2c7'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
graph: {
|
||||
color: colorPalette
|
||||
},
|
||||
|
||||
gauge : {
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: [[0.2, '#E01F54'],[0.8, '#b8d2c7'],[1, '#001852']],
|
||||
width: 8
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
echarts.registerTheme('roma', theme);
|
||||
}));
|
||||
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
(function (root, factory) {if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['exports', 'echarts'], factory);
|
||||
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
|
||||
// CommonJS
|
||||
factory(exports, require('echarts'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory({}, root.echarts);
|
||||
}
|
||||
}(this, function (exports, echarts) {
|
||||
var log = function (msg) {
|
||||
if (typeof console !== 'undefined') {
|
||||
console && console.error && console.error(msg);
|
||||
}
|
||||
};
|
||||
if (!echarts) {
|
||||
log('ECharts is not Loaded');
|
||||
return;
|
||||
}
|
||||
|
||||
var colorPalette = [
|
||||
'#c12e34','#e6b600','#0098d9','#2b821d',
|
||||
'#005eaa','#339ca8','#cda819','#32a487'
|
||||
];
|
||||
|
||||
var theme = {
|
||||
|
||||
color: colorPalette,
|
||||
|
||||
title: {
|
||||
textStyle: {
|
||||
fontWeight: 'normal'
|
||||
}
|
||||
},
|
||||
|
||||
visualMap: {
|
||||
color:['#1790cf','#a2d4e6']
|
||||
},
|
||||
|
||||
toolbox: {
|
||||
iconStyle: {
|
||||
normal: {
|
||||
borderColor: '#06467c'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
tooltip: {
|
||||
backgroundColor: 'rgba(0,0,0,0.6)'
|
||||
},
|
||||
|
||||
dataZoom: {
|
||||
dataBackgroundColor: '#dedede',
|
||||
fillerColor: 'rgba(154,217,247,0.2)',
|
||||
handleColor: '#005eaa'
|
||||
},
|
||||
|
||||
timeline: {
|
||||
lineStyle: {
|
||||
color: '#005eaa'
|
||||
},
|
||||
controlStyle: {
|
||||
normal: {
|
||||
color: '#005eaa',
|
||||
borderColor: '#005eaa'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
candlestick: {
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#c12e34',
|
||||
color0: '#2b821d',
|
||||
lineStyle: {
|
||||
width: 1,
|
||||
color: '#c12e34',
|
||||
color0: '#2b821d'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
graph: {
|
||||
color: colorPalette
|
||||
},
|
||||
|
||||
map: {
|
||||
label: {
|
||||
normal: {
|
||||
textStyle: {
|
||||
color: '#c12e34'
|
||||
}
|
||||
},
|
||||
emphasis: {
|
||||
textStyle: {
|
||||
color: '#c12e34'
|
||||
}
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
borderColor: '#eee',
|
||||
areaColor: '#ddd'
|
||||
},
|
||||
emphasis: {
|
||||
areaColor: '#e6b600'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
gauge: {
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: [[0.2, '#2b821d'],[0.8, '#005eaa'],[1, '#c12e34']],
|
||||
width: 5
|
||||
}
|
||||
},
|
||||
axisTick: {
|
||||
splitNumber: 10,
|
||||
length:8,
|
||||
lineStyle: {
|
||||
color: 'auto'
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
textStyle: {
|
||||
color: 'auto'
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
length: 12,
|
||||
lineStyle: {
|
||||
color: 'auto'
|
||||
}
|
||||
},
|
||||
pointer: {
|
||||
length: '90%',
|
||||
width: 3,
|
||||
color: 'auto'
|
||||
},
|
||||
title: {
|
||||
textStyle: {
|
||||
color: '#333'
|
||||
}
|
||||
},
|
||||
detail: {
|
||||
textStyle: {
|
||||
color: 'auto'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
echarts.registerTheme('shine', theme);
|
||||
}));
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
title: {
|
||||
text: 'Area Chart',
|
||||
left: 'center',
|
||||
top: '3%',
|
||||
textStyle: {
|
||||
fontWeight: 'normal'
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '12%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday','Sunday']
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
splitNumber: 3
|
||||
},
|
||||
dataZoom: {
|
||||
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name:'Email',
|
||||
type:'line',
|
||||
stack: '总量',
|
||||
areaStyle: {normal: {}},
|
||||
data:[120, 132, 101, 134, 90, 230, 210]
|
||||
},
|
||||
{
|
||||
name:'联盟广告',
|
||||
type:'line',
|
||||
stack: '总量',
|
||||
areaStyle: {normal: {}},
|
||||
data:[220, 182, 191, 234, 290, 330, 310]
|
||||
},
|
||||
{
|
||||
name:'视频广告',
|
||||
type:'line',
|
||||
stack: '总量',
|
||||
areaStyle: {normal: {}},
|
||||
data:[150, 232, 201, 154, 190, 330, 410]
|
||||
},
|
||||
{
|
||||
name:'直接访问',
|
||||
type:'line',
|
||||
stack: '总量',
|
||||
areaStyle: {normal: {}},
|
||||
data:[320, 332, 301, 334, 390, 330, 320]
|
||||
},
|
||||
{
|
||||
name:'搜索引擎',
|
||||
type:'line',
|
||||
stack: '总量',
|
||||
label: {
|
||||
normal: {
|
||||
show: true,
|
||||
position: 'top'
|
||||
}
|
||||
},
|
||||
areaStyle: {normal: {}},
|
||||
data:[820, 932, 901, 934, 1290, 1330, 1320]
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
title: {
|
||||
text: 'Bar Chart',
|
||||
left: 'center',
|
||||
top: '3%',
|
||||
textStyle: {
|
||||
fontWeight: 'normal'
|
||||
}
|
||||
},
|
||||
toolbox: {
|
||||
top: '3%',
|
||||
feature: {
|
||||
magicType: {
|
||||
type: ['line', 'bar', 'stack', 'tiled']
|
||||
},
|
||||
restore: {},
|
||||
dataZoom: {},
|
||||
saveAsImage: {}
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: '13%',
|
||||
right: '5%',
|
||||
bottom: '5%',
|
||||
textStyle: {
|
||||
fontWeight: 'normal'
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
data: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday','Sunday']
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name:'直接访问',
|
||||
type:'bar',
|
||||
stack: '总量',
|
||||
label: {
|
||||
normal: {
|
||||
show: true,
|
||||
position: 'insideRight'
|
||||
}
|
||||
},
|
||||
data:[320, 302, 301, 334, 390, 330, 320]
|
||||
},
|
||||
{
|
||||
name:'邮件营销',
|
||||
type:'bar',
|
||||
stack: '总量',
|
||||
label: {
|
||||
normal: {
|
||||
show: true,
|
||||
position: 'insideRight'
|
||||
}
|
||||
},
|
||||
data:[120, 132, 101, 134, 90, 230, 210]
|
||||
},
|
||||
{
|
||||
name:'联盟广告',
|
||||
type:'bar',
|
||||
stack: '总量',
|
||||
label: {
|
||||
normal: {
|
||||
show: true,
|
||||
position: 'insideRight'
|
||||
}
|
||||
},
|
||||
data:[220, 182, 191, 234, 290, 330, 310]
|
||||
},
|
||||
{
|
||||
name:'视频广告',
|
||||
type:'bar',
|
||||
stack: '总量',
|
||||
label: {
|
||||
normal: {
|
||||
show: true,
|
||||
position: 'insideRight'
|
||||
}
|
||||
},
|
||||
data:[150, 212, 201, 154, 190, 330, 410]
|
||||
},
|
||||
{
|
||||
name:'搜索引擎',
|
||||
type:'bar',
|
||||
stack: '总量',
|
||||
label: {
|
||||
normal: {
|
||||
show: true,
|
||||
position: 'insideRight'
|
||||
}
|
||||
},
|
||||
data:[820, 832, 901, 934, 1290, 1330, 1320]
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
visualMap: {
|
||||
show: true,
|
||||
min: 0,
|
||||
max: 1500,
|
||||
right: 50,
|
||||
top: 'middle',
|
||||
text:['高','低']
|
||||
// orient: 'horizontal'
|
||||
},
|
||||
selectedMode: 'single',
|
||||
series : [
|
||||
{
|
||||
name: 'iphone3',
|
||||
type: 'map',
|
||||
map: 'china',
|
||||
showLegendSymbol: true,
|
||||
label: {
|
||||
normal: {
|
||||
show: false
|
||||
},
|
||||
emphasis: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
data:[
|
||||
{name: '北京',value: 500},
|
||||
{name: '天津',value: 500},
|
||||
{name: '上海',value: 500},
|
||||
{name: '重庆',value: 500},
|
||||
{name: '河北',value: 500},
|
||||
{name: '河南',value: 500},
|
||||
{name: '云南',value: 500},
|
||||
{name: '辽宁',value: 500},
|
||||
{name: '黑龙江',value: 500},
|
||||
{name: '湖南',value: 500},
|
||||
{name: '安徽',value: 500},
|
||||
{name: '山东',value: 500},
|
||||
{name: '新疆',value: 500},
|
||||
{name: '江苏',value: 500},
|
||||
{name: '浙江',value: 500},
|
||||
{name: '江西',value: 500},
|
||||
{name: '湖北',value: 500},
|
||||
{name: '广西',value: 500},
|
||||
{name: '甘肃',value: 500},
|
||||
{name: '山西',value: 500},
|
||||
{name: '内蒙古',value: 500},
|
||||
{name: '陕西',value: 500},
|
||||
{name: '吉林',value: 500},
|
||||
{name: '福建',value: 500},
|
||||
{name: '贵州',value: 500},
|
||||
{name: '广东',value: 500},
|
||||
{name: '青海',value: 500},
|
||||
{name: '西藏',value: 500},
|
||||
{name: '四川',value: 500},
|
||||
{name: '宁夏',value: 500},
|
||||
{name: '海南',value: 500},
|
||||
{name: '台湾',value: 500},
|
||||
{name: '香港',value: 500},
|
||||
{name: '澳门',value: 500}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'iphone4',
|
||||
type: 'map',
|
||||
mapType: 'china',
|
||||
showLegendSymbol: true,
|
||||
label: {
|
||||
normal: {
|
||||
show: false
|
||||
},
|
||||
emphasis: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
data:[
|
||||
{name: '北京',value: 500},
|
||||
{name: '天津',value: 500},
|
||||
{name: '上海',value: 500},
|
||||
{name: '重庆',value: 500},
|
||||
{name: '河北',value: 500},
|
||||
{name: '安徽',value: 500},
|
||||
{name: '新疆',value: 500},
|
||||
{name: '浙江',value: 500},
|
||||
{name: '江西',value: 500},
|
||||
{name: '山西',value: 500},
|
||||
{name: '内蒙古',value: 500},
|
||||
{name: '吉林',value: 500},
|
||||
{name: '福建',value: 500},
|
||||
{name: '广东',value: 500},
|
||||
{name: '西藏',value: 500},
|
||||
{name: '四川',value: 500},
|
||||
{name: '宁夏',value: 500},
|
||||
{name: '香港',value: 500},
|
||||
{name: '澳门',value: 500}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'iphone5',
|
||||
type: 'map',
|
||||
mapType: 'china',
|
||||
showLegendSymbol: true,
|
||||
label: {
|
||||
normal: {
|
||||
show: false
|
||||
},
|
||||
emphasis: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
data:[
|
||||
{name: '北京',value: 500},
|
||||
{name: '天津',value: 500},
|
||||
{name: '上海',value: 500},
|
||||
{name: '广东',value: 500},
|
||||
{name: '台湾',value: 500},
|
||||
{name: '香港',value: 500},
|
||||
{name: '澳门',value: 500}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
legend: {
|
||||
bottom: '5%',
|
||||
data: ['rose1', 'rose2', 'rose3', 'rose4']
|
||||
},
|
||||
series : [
|
||||
{
|
||||
name:'半径模式',
|
||||
type:'pie',
|
||||
radius : [20, 80],
|
||||
center : ['25%', 110],
|
||||
label: {
|
||||
normal: {
|
||||
show: false
|
||||
},
|
||||
emphasis: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
lableLine: {
|
||||
normal: {
|
||||
show: false
|
||||
},
|
||||
emphasis: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
data:[
|
||||
{value:10, name:'rose1'},
|
||||
{value:5, name:'rose2'},
|
||||
{value:15, name:'rose3'},
|
||||
{value:25, name:'rose4'},
|
||||
{value:20, name:'rose5'},
|
||||
{value:35, name:'rose6'},
|
||||
{value:30, name:'rose7'},
|
||||
{value:40, name:'rose8'}
|
||||
]
|
||||
},
|
||||
{
|
||||
name:'面积模式',
|
||||
type:'pie',
|
||||
radius : [30, 80],
|
||||
center : ['75%', 110],
|
||||
roseType : 'area',
|
||||
labelLine: {
|
||||
normal: {
|
||||
length: 5
|
||||
}
|
||||
},
|
||||
data:[
|
||||
{value:10, name:'rose1'},
|
||||
{value:5, name:'rose2'},
|
||||
{value:15, name:'rose3'},
|
||||
{value:25, name:'rose4'},
|
||||
{value:20, name:'rose5'},
|
||||
{value:35, name:'rose6'},
|
||||
{value:30, name:'rose7'},
|
||||
{value:40, name:'rose8'}
|
||||
]
|
||||
},
|
||||
{
|
||||
name:'仪表盘',
|
||||
type:'gauge',
|
||||
radius : 100,
|
||||
center : ['50%', 280],
|
||||
detail : {formatter:'{value}%'},
|
||||
data:[
|
||||
{value:50, name:'Gauge'}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -0,0 +1,201 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
timeline: {
|
||||
left: '2%',
|
||||
right: '2%',
|
||||
data: [
|
||||
'2002-01-01','2003-01-01','2004-01-01',
|
||||
{
|
||||
value: '2005-01-01',
|
||||
symbol: 'diamond',
|
||||
symbolSize: 16
|
||||
},
|
||||
'2006-01-01', '2007-01-01','2008-01-01','2009-01-01','2010-01-01',
|
||||
{
|
||||
value: '2011-01-01',
|
||||
symbol: 'diamond',
|
||||
symbolSize: 18
|
||||
}
|
||||
],
|
||||
label: {
|
||||
formatter : function(s) {
|
||||
return (new Date(s)).getFullYear();
|
||||
}
|
||||
}
|
||||
},
|
||||
options: [{
|
||||
grid: {
|
||||
left: '13%',
|
||||
right: '5%',
|
||||
bottom: '20%'
|
||||
},
|
||||
xAxis: {
|
||||
type : 'value',
|
||||
scale:true,
|
||||
axisLabel : {
|
||||
formatter: '{value} cm'
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type : 'value',
|
||||
scale:true,
|
||||
axisLabel : {
|
||||
formatter: '{value} kg'
|
||||
}
|
||||
},
|
||||
series : [
|
||||
{
|
||||
name:'女性',
|
||||
type:'scatter',
|
||||
data: [[161.2, 51.6], [167.5, 59.0], [159.5, 49.2], [157.0, 63.0], [155.8, 53.6],
|
||||
[170.0, 59.0], [159.1, 47.6], [166.0, 69.8], [176.2, 66.8], [160.2, 75.2],
|
||||
[172.5, 55.2], [170.9, 54.2], [172.9, 62.5], [153.4, 42.0], [160.0, 50.0],
|
||||
[147.2, 49.8], [168.2, 49.2], [175.0, 73.2], [157.0, 47.8], [167.6, 68.8],
|
||||
[159.5, 50.6], [175.0, 82.5], [166.8, 57.2], [176.5, 87.8], [170.2, 72.8],
|
||||
[174.0, 54.5], [173.0, 59.8], [179.9, 67.3], [170.5, 67.8], [160.0, 47.0],
|
||||
[154.4, 46.2], [162.0, 55.0], [176.5, 83.0], [160.0, 54.4], [152.0, 45.8],
|
||||
[162.1, 53.6], [170.0, 73.2], [160.2, 52.1], [161.3, 67.9], [166.4, 56.6],
|
||||
[168.9, 62.3], [163.8, 58.5], [167.6, 54.5], [160.0, 50.2], [161.3, 60.3],
|
||||
[167.6, 58.3], [165.1, 56.2], [160.0, 50.2], [170.0, 72.9], [157.5, 59.8],
|
||||
[167.6, 61.0], [160.7, 69.1], [163.2, 55.9], [152.4, 46.5], [157.5, 54.3],
|
||||
[168.3, 54.8], [180.3, 60.7], [165.5, 60.0], [165.0, 62.0], [164.5, 60.3],
|
||||
[156.0, 52.7], [160.0, 74.3], [163.0, 62.0], [165.7, 73.1], [161.0, 80.0],
|
||||
[162.0, 54.7], [166.0, 53.2], [174.0, 75.7], [172.7, 61.1], [167.6, 55.7],
|
||||
[151.1, 48.7], [164.5, 52.3], [163.5, 50.0], [152.0, 59.3], [169.0, 62.5],
|
||||
[164.0, 55.7], [161.2, 54.8], [155.0, 45.9], [170.0, 70.6], [176.2, 67.2],
|
||||
[170.0, 69.4], [162.5, 58.2], [170.3, 64.8], [164.1, 71.6], [169.5, 52.8],
|
||||
[163.2, 59.8], [154.5, 49.0], [159.8, 50.0], [173.2, 69.2], [170.0, 55.9],
|
||||
[161.4, 63.4], [169.0, 58.2], [166.2, 58.6], [159.4, 45.7], [162.5, 52.2],
|
||||
[159.0, 48.6], [162.8, 57.8], [159.0, 55.6], [179.8, 66.8], [162.9, 59.4],
|
||||
[161.0, 53.6], [151.1, 73.2], [168.2, 53.4], [168.9, 69.0], [173.2, 58.4],
|
||||
[171.8, 56.2], [178.0, 70.6], [164.3, 59.8], [163.0, 72.0], [168.5, 65.2],
|
||||
[166.8, 56.6], [172.7, 105.2], [163.5, 51.8], [169.4, 63.4], [167.8, 59.0],
|
||||
[159.5, 47.6], [167.6, 63.0], [161.2, 55.2], [160.0, 45.0], [163.2, 54.0],
|
||||
[162.2, 50.2], [161.3, 60.2], [149.5, 44.8], [157.5, 58.8], [163.2, 56.4],
|
||||
[172.7, 62.0], [155.0, 49.2], [156.5, 67.2], [164.0, 53.8], [160.9, 54.4],
|
||||
[162.8, 58.0], [167.0, 59.8], [160.0, 54.8], [160.0, 43.2], [168.9, 60.5],
|
||||
[158.2, 46.4], [156.0, 64.4], [160.0, 48.8], [167.1, 62.2], [158.0, 55.5],
|
||||
[167.6, 57.8], [156.0, 54.6], [162.1, 59.2], [173.4, 52.7], [159.8, 53.2],
|
||||
[170.5, 64.5], [159.2, 51.8], [157.5, 56.0], [161.3, 63.6], [162.6, 63.2],
|
||||
[160.0, 59.5], [168.9, 56.8], [165.1, 64.1], [162.6, 50.0], [165.1, 72.3],
|
||||
[166.4, 55.0], [160.0, 55.9], [152.4, 60.4], [170.2, 69.1], [162.6, 84.5],
|
||||
[170.2, 55.9], [158.8, 55.5], [172.7, 69.5], [167.6, 76.4], [162.6, 61.4],
|
||||
[167.6, 65.9], [156.2, 58.6], [175.2, 66.8], [172.1, 56.6], [162.6, 58.6],
|
||||
[160.0, 55.9], [165.1, 59.1], [182.9, 81.8], [166.4, 70.7], [165.1, 56.8],
|
||||
[177.8, 60.0], [165.1, 58.2], [175.3, 72.7], [154.9, 54.1], [158.8, 49.1],
|
||||
[172.7, 75.9], [168.9, 55.0], [161.3, 57.3], [167.6, 55.0], [165.1, 65.5],
|
||||
[175.3, 65.5], [157.5, 48.6], [163.8, 58.6], [167.6, 63.6], [165.1, 55.2],
|
||||
[165.1, 62.7], [168.9, 56.6], [162.6, 53.9], [164.5, 63.2], [176.5, 73.6],
|
||||
[168.9, 62.0], [175.3, 63.6], [159.4, 53.2], [160.0, 53.4], [170.2, 55.0],
|
||||
[162.6, 70.5], [167.6, 54.5], [162.6, 54.5], [160.7, 55.9], [160.0, 59.0],
|
||||
[157.5, 63.6], [162.6, 54.5], [152.4, 47.3], [170.2, 67.7], [165.1, 80.9],
|
||||
[172.7, 70.5], [165.1, 60.9], [170.2, 63.6], [170.2, 54.5], [170.2, 59.1],
|
||||
[161.3, 70.5], [167.6, 52.7], [167.6, 62.7], [165.1, 86.3], [162.6, 66.4],
|
||||
[152.4, 67.3], [168.9, 63.0], [170.2, 73.6], [175.2, 62.3], [175.2, 57.7],
|
||||
[160.0, 55.4], [165.1, 104.1], [174.0, 55.5], [170.2, 77.3], [160.0, 80.5],
|
||||
[167.6, 64.5], [167.6, 72.3], [167.6, 61.4], [154.9, 58.2], [162.6, 81.8],
|
||||
[175.3, 63.6], [171.4, 53.4], [157.5, 54.5], [165.1, 53.6], [160.0, 60.0],
|
||||
[174.0, 73.6], [162.6, 61.4], [174.0, 55.5], [162.6, 63.6], [161.3, 60.9],
|
||||
[156.2, 60.0], [149.9, 46.8], [169.5, 57.3], [160.0, 64.1], [175.3, 63.6],
|
||||
[169.5, 67.3], [160.0, 75.5], [172.7, 68.2], [162.6, 61.4], [157.5, 76.8],
|
||||
[176.5, 71.8], [164.4, 55.5], [160.7, 48.6], [174.0, 66.4], [163.8, 67.3]
|
||||
],
|
||||
markPoint : {
|
||||
data : [
|
||||
{type : 'max', name: '最大值'},
|
||||
{type : 'min', name: '最小值'}
|
||||
]
|
||||
},
|
||||
markLine : {
|
||||
data : [
|
||||
{type : 'average', name: '平均值'}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
name:'男性',
|
||||
type:'scatter',
|
||||
data: [[174.0, 65.6], [175.3, 71.8], [193.5, 80.7], [186.5, 72.6], [187.2, 78.8],
|
||||
[181.5, 74.8], [184.0, 86.4], [184.5, 78.4], [175.0, 62.0], [184.0, 81.6],
|
||||
[180.0, 76.6], [177.8, 83.6], [192.0, 90.0], [176.0, 74.6], [174.0, 71.0],
|
||||
[184.0, 79.6], [192.7, 93.8], [171.5, 70.0], [173.0, 72.4], [176.0, 85.9],
|
||||
[176.0, 78.8], [180.5, 77.8], [172.7, 66.2], [176.0, 86.4], [173.5, 81.8],
|
||||
[178.0, 89.6], [180.3, 82.8], [180.3, 76.4], [164.5, 63.2], [173.0, 60.9],
|
||||
[183.5, 74.8], [175.5, 70.0], [188.0, 72.4], [189.2, 84.1], [172.8, 69.1],
|
||||
[170.0, 59.5], [182.0, 67.2], [170.0, 61.3], [177.8, 68.6], [184.2, 80.1],
|
||||
[186.7, 87.8], [171.4, 84.7], [172.7, 73.4], [175.3, 72.1], [180.3, 82.6],
|
||||
[182.9, 88.7], [188.0, 84.1], [177.2, 94.1], [172.1, 74.9], [167.0, 59.1],
|
||||
[169.5, 75.6], [174.0, 86.2], [172.7, 75.3], [182.2, 87.1], [164.1, 55.2],
|
||||
[163.0, 57.0], [171.5, 61.4], [184.2, 76.8], [174.0, 86.8], [174.0, 72.2],
|
||||
[177.0, 71.6], [186.0, 84.8], [167.0, 68.2], [171.8, 66.1], [182.0, 72.0],
|
||||
[167.0, 64.6], [177.8, 74.8], [164.5, 70.0], [192.0, 101.6], [175.5, 63.2],
|
||||
[171.2, 79.1], [181.6, 78.9], [167.4, 67.7], [181.1, 66.0], [177.0, 68.2],
|
||||
[174.5, 63.9], [177.5, 72.0], [170.5, 56.8], [182.4, 74.5], [197.1, 90.9],
|
||||
[180.1, 93.0], [175.5, 80.9], [180.6, 72.7], [184.4, 68.0], [175.5, 70.9],
|
||||
[180.6, 72.5], [177.0, 72.5], [177.1, 83.4], [181.6, 75.5], [176.5, 73.0],
|
||||
[175.0, 70.2], [174.0, 73.4], [165.1, 70.5], [177.0, 68.9], [192.0, 102.3],
|
||||
[176.5, 68.4], [169.4, 65.9], [182.1, 75.7], [179.8, 84.5], [175.3, 87.7],
|
||||
[184.9, 86.4], [177.3, 73.2], [167.4, 53.9], [178.1, 72.0], [168.9, 55.5],
|
||||
[157.2, 58.4], [180.3, 83.2], [170.2, 72.7], [177.8, 64.1], [172.7, 72.3],
|
||||
[165.1, 65.0], [186.7, 86.4], [165.1, 65.0], [174.0, 88.6], [175.3, 84.1],
|
||||
[185.4, 66.8], [177.8, 75.5], [180.3, 93.2], [180.3, 82.7], [177.8, 58.0],
|
||||
[177.8, 79.5], [177.8, 78.6], [177.8, 71.8], [177.8, 116.4], [163.8, 72.2],
|
||||
[188.0, 83.6], [198.1, 85.5], [175.3, 90.9], [166.4, 85.9], [190.5, 89.1],
|
||||
[166.4, 75.0], [177.8, 77.7], [179.7, 86.4], [172.7, 90.9], [190.5, 73.6],
|
||||
[185.4, 76.4], [168.9, 69.1], [167.6, 84.5], [175.3, 64.5], [170.2, 69.1],
|
||||
[190.5, 108.6], [177.8, 86.4], [190.5, 80.9], [177.8, 87.7], [184.2, 94.5],
|
||||
[176.5, 80.2], [177.8, 72.0], [180.3, 71.4], [171.4, 72.7], [172.7, 84.1],
|
||||
[172.7, 76.8], [177.8, 63.6], [177.8, 80.9], [182.9, 80.9], [170.2, 85.5],
|
||||
[167.6, 68.6], [175.3, 67.7], [165.1, 66.4], [185.4, 102.3], [181.6, 70.5],
|
||||
[172.7, 95.9], [190.5, 84.1], [179.1, 87.3], [175.3, 71.8], [170.2, 65.9],
|
||||
[193.0, 95.9], [171.4, 91.4], [177.8, 81.8], [177.8, 96.8], [167.6, 69.1],
|
||||
[167.6, 82.7], [180.3, 75.5], [182.9, 79.5], [176.5, 73.6], [186.7, 91.8],
|
||||
[188.0, 84.1], [188.0, 85.9], [177.8, 81.8], [174.0, 82.5], [177.8, 80.5],
|
||||
[171.4, 70.0], [185.4, 81.8], [185.4, 84.1], [188.0, 90.5], [188.0, 91.4],
|
||||
[182.9, 89.1], [176.5, 85.0], [175.3, 69.1], [175.3, 73.6], [188.0, 80.5],
|
||||
[188.0, 82.7], [175.3, 86.4], [170.5, 67.7], [179.1, 92.7], [177.8, 93.6],
|
||||
[175.3, 70.9], [182.9, 75.0], [170.8, 93.2], [188.0, 93.2], [180.3, 77.7],
|
||||
[177.8, 61.4], [185.4, 94.1], [168.9, 75.0], [185.4, 83.6], [180.3, 85.5],
|
||||
[174.0, 73.9], [167.6, 66.8], [182.9, 87.3], [160.0, 72.3], [180.3, 88.6],
|
||||
[167.6, 75.5], [186.7, 101.4], [175.3, 91.1], [175.3, 67.3], [175.9, 77.7],
|
||||
[175.3, 81.8], [179.1, 75.5], [181.6, 84.5], [177.8, 76.6], [182.9, 85.0],
|
||||
[177.8, 102.5], [184.2, 77.3], [179.1, 71.8], [176.5, 87.9], [188.0, 94.3],
|
||||
[174.0, 70.9], [167.6, 64.5], [170.2, 77.3], [167.6, 72.3], [188.0, 87.3],
|
||||
[174.0, 80.0], [176.5, 82.3], [180.3, 73.6], [167.6, 74.1], [188.0, 85.9],
|
||||
[180.3, 73.2], [167.6, 76.3], [183.0, 65.9], [183.0, 90.9], [179.1, 89.1],
|
||||
[170.2, 62.3], [177.8, 82.7], [179.1, 79.1], [190.5, 98.2], [177.8, 84.1],
|
||||
[180.3, 83.2], [180.3, 83.2]
|
||||
],
|
||||
markPoint : {
|
||||
data : [
|
||||
{type : 'max', name: '最大值'},
|
||||
{type : 'min', name: '最小值'}
|
||||
]
|
||||
},
|
||||
markLine : {
|
||||
data : [
|
||||
{type : 'average', name: '平均值'}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
};
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
var glob = require('glob');
|
||||
var Canvas = require('canvas');
|
||||
var echarts = require('echarts');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
require('echarts/map/js/china');
|
||||
|
||||
var options = {
|
||||
bar: require('./option/bar'),
|
||||
area: require('./option/area'),
|
||||
scatter: require('./option/scatter'),
|
||||
pie: require('./option/pie'),
|
||||
graph: require('./option/graph'),
|
||||
map: require('./option/map')
|
||||
};
|
||||
var WIDTH = 600;
|
||||
var HEIGHT = 400;
|
||||
echarts.setCanvasCreator(function () {
|
||||
return createCanvas();
|
||||
});
|
||||
|
||||
var font = new Canvas.Font('Helvetica', '/System/Library/Fonts/Helvetica.dfont');
|
||||
font.addFace('/System/Library/Fonts/Helvetica.dfont', 'bolder');
|
||||
|
||||
glob('../*.js', function (err, themePathList) {
|
||||
themePathList.forEach(function (themePath) {
|
||||
var themeName = path.basename(themePath, '.js');
|
||||
var canvasList = [];
|
||||
require(themePath);
|
||||
echarts.util.each(options, function (option) {
|
||||
var canvas = createCanvas();
|
||||
var chart = echarts.init(canvas, themeName);
|
||||
var optionNeedFix = option;
|
||||
if (option.options) {
|
||||
optionNeedFix = option.options[0];
|
||||
}
|
||||
canvasList.push(canvas);
|
||||
optionNeedFix.animation = false;
|
||||
optionNeedFix.textStyle = {
|
||||
fontFamily: 'Helvetica',
|
||||
fontSize: 12
|
||||
};
|
||||
chart.setOption(option);
|
||||
chart.dispose();
|
||||
});
|
||||
|
||||
var columnCount = 2;
|
||||
var outputCanvas = new Canvas(WIDTH * columnCount, HEIGHT * canvasList.length / columnCount);
|
||||
var outputCtx = outputCanvas.getContext('2d');
|
||||
canvasList.forEach(function (canvas, idx) {
|
||||
outputCtx.drawImage(canvas, idx % columnCount * WIDTH, Math.floor(idx / columnCount) * HEIGHT, WIDTH, HEIGHT);
|
||||
});
|
||||
|
||||
fs.writeFileSync('../thumb/' + themeName + '.png', outputCanvas.toBuffer());
|
||||
});
|
||||
});
|
||||
function createCanvas() {
|
||||
var canvas = new Canvas(WIDTH, HEIGHT);
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.addFont(font);
|
||||
return canvas;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['exports', 'echarts'], factory);
|
||||
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
|
||||
// CommonJS
|
||||
factory(exports, require('echarts'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory({}, root.echarts);
|
||||
}
|
||||
}(this, function (exports, echarts) {
|
||||
var log = function (msg) {
|
||||
if (typeof console !== 'undefined') {
|
||||
console && console.error && console.error(msg);
|
||||
}
|
||||
};
|
||||
if (!echarts) {
|
||||
log('ECharts is not Loaded');
|
||||
return;
|
||||
}
|
||||
var colorPalette = ['#d87c7c','#919e8b', '#d7ab82', '#6e7074','#61a0a8','#efa18d', '#787464', '#cc7e63', '#724e58', '#4b565b'];
|
||||
echarts.registerTheme('vintage', {
|
||||
color: colorPalette,
|
||||
backgroundColor: '#fef8ef',
|
||||
graph: {
|
||||
color: colorPalette
|
||||
}
|
||||
});
|
||||
}));
|
||||
@@ -0,0 +1,894 @@
|
||||
@charset "utf-8";
|
||||
/* dialog样式 */
|
||||
.wrapper {
|
||||
zoom: 1;
|
||||
width: 630px;
|
||||
*width: 626px;
|
||||
height: 380px;
|
||||
margin: 0 auto;
|
||||
padding: 10px;
|
||||
position: relative;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
/*tab样式框大小*/
|
||||
.tabhead {
|
||||
float:left;
|
||||
}
|
||||
.tabbody {
|
||||
width: 100%;
|
||||
height: 346px;
|
||||
position: relative;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.tabbody .panel {
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tabbody .panel.focus {
|
||||
width: 100%;
|
||||
height: 346px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* 图片对齐方式 */
|
||||
.alignBar{
|
||||
float:right;
|
||||
margin-top: 5px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.alignBar .algnLabel{
|
||||
float:left;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.alignBar #alignIcon{
|
||||
zoom:1;
|
||||
_display: inline;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
.alignBar #alignIcon span{
|
||||
float: left;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
width: 19px;
|
||||
height: 17px;
|
||||
margin-right: 3px;
|
||||
margin-left: 3px;
|
||||
background-image: url(./images/alignicon.jpg);
|
||||
}
|
||||
.alignBar #alignIcon .none-align{
|
||||
background-position: 0 -18px;
|
||||
}
|
||||
.alignBar #alignIcon .left-align{
|
||||
background-position: -20px -18px;
|
||||
}
|
||||
.alignBar #alignIcon .right-align{
|
||||
background-position: -40px -18px;
|
||||
}
|
||||
.alignBar #alignIcon .center-align{
|
||||
background-position: -60px -18px;
|
||||
}
|
||||
.alignBar #alignIcon .none-align.focus{
|
||||
background-position: 0 0;
|
||||
}
|
||||
.alignBar #alignIcon .left-align.focus{
|
||||
background-position: -20px 0;
|
||||
}
|
||||
.alignBar #alignIcon .right-align.focus{
|
||||
background-position: -40px 0;
|
||||
}
|
||||
.alignBar #alignIcon .center-align.focus{
|
||||
background-position: -60px 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* 远程图片样式 */
|
||||
#remote {
|
||||
z-index: 200;
|
||||
}
|
||||
|
||||
#remote .top{
|
||||
width: 100%;
|
||||
margin-top: 25px;
|
||||
}
|
||||
#remote .left{
|
||||
display: block;
|
||||
float: left;
|
||||
width: 300px;
|
||||
height:10px;
|
||||
}
|
||||
#remote .right{
|
||||
display: block;
|
||||
float: right;
|
||||
width: 300px;
|
||||
height:10px;
|
||||
}
|
||||
#remote .row{
|
||||
margin-left: 20px;
|
||||
clear: both;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
#remote .row label{
|
||||
text-align: center;
|
||||
width: 50px;
|
||||
zoom:1;
|
||||
_display: inline;
|
||||
display:inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
#remote .row label.algnLabel{
|
||||
float: left;
|
||||
|
||||
}
|
||||
|
||||
#remote input.text{
|
||||
width: 150px;
|
||||
padding: 3px 6px;
|
||||
font-size: 14px;
|
||||
line-height: 1.42857143;
|
||||
color: #555;
|
||||
background-color: #fff;
|
||||
background-image: none;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
||||
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
||||
}
|
||||
#remote input.text:focus {
|
||||
border-color: #66afe9;
|
||||
outline: 0;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
|
||||
}
|
||||
#remote #url{
|
||||
width: 500px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
#remote #width,
|
||||
#remote #height{
|
||||
width: 20px;
|
||||
margin-left: 2px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
#remote #border,
|
||||
#remote #vhSpace,
|
||||
#remote #title{
|
||||
width: 180px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
#remote #lock{
|
||||
}
|
||||
#remote #lockicon{
|
||||
zoom: 1;
|
||||
_display:inline;
|
||||
display: inline-block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background: url("../../themes/default/images/lock.gif") -13px -13px no-repeat;
|
||||
vertical-align: middle;
|
||||
}
|
||||
#remote #preview{
|
||||
clear: both;
|
||||
width: 260px;
|
||||
height: 240px;
|
||||
z-index: 9999;
|
||||
margin-top: 10px;
|
||||
background-color: #eee;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 上传图片 */
|
||||
.tabbody #upload.panel {
|
||||
width: 0;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
position: absolute !important;
|
||||
clip: rect(1px, 1px, 1px, 1px);
|
||||
background: #fff;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.tabbody #upload.panel.focus {
|
||||
width: 100%;
|
||||
height: 346px;
|
||||
display: block;
|
||||
clip: auto;
|
||||
}
|
||||
|
||||
#upload .queueList {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#upload p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.element-invisible {
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
position: absolute !important;
|
||||
clip: rect(1px, 1px, 1px, 1px);
|
||||
}
|
||||
|
||||
#upload .placeholder {
|
||||
margin: 10px;
|
||||
border: 2px dashed #e6e6e6;
|
||||
*border: 0px dashed #e6e6e6;
|
||||
height: 172px;
|
||||
padding-top: 150px;
|
||||
text-align: center;
|
||||
background: url(./images/image.png) center 70px no-repeat;
|
||||
color: #cccccc;
|
||||
font-size: 18px;
|
||||
position: relative;
|
||||
top:0;
|
||||
*top: 10px;
|
||||
}
|
||||
|
||||
#upload .placeholder .webuploader-pick {
|
||||
font-size: 18px;
|
||||
background: #00b7ee;
|
||||
border-radius: 3px;
|
||||
line-height: 44px;
|
||||
padding: 0 30px;
|
||||
*width: 120px;
|
||||
color: #fff;
|
||||
display: inline-block;
|
||||
margin: 0 auto 20px auto;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
#upload .placeholder .webuploader-pick-hover {
|
||||
background: #00a2d4;
|
||||
}
|
||||
|
||||
|
||||
#filePickerContainer {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#upload .placeholder .flashTip {
|
||||
color: #666666;
|
||||
font-size: 12px;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
bottom: 20px;
|
||||
}
|
||||
|
||||
#upload .placeholder .flashTip a {
|
||||
color: #0785d1;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#upload .placeholder .flashTip a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#upload .placeholder.webuploader-dnd-over {
|
||||
border-color: #999999;
|
||||
}
|
||||
|
||||
#upload .filelist {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
position: relative;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
#upload .filelist:after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
clear: both;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#upload .filelist li {
|
||||
width: 113px;
|
||||
height: 113px;
|
||||
background: url(./images/bg.png);
|
||||
text-align: center;
|
||||
margin: 9px 0 0 9px;
|
||||
*margin: 6px 0 0 6px;
|
||||
position: relative;
|
||||
display: block;
|
||||
float: left;
|
||||
overflow: hidden;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
#upload .filelist li p.log {
|
||||
position: relative;
|
||||
top: -45px;
|
||||
}
|
||||
|
||||
#upload .filelist li p.title {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
top: 5px;
|
||||
text-indent: 5px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#upload .filelist li p.progress {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
height: 8px;
|
||||
overflow: hidden;
|
||||
z-index: 50;
|
||||
margin: 0;
|
||||
border-radius: 0;
|
||||
background: none;
|
||||
-webkit-box-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
#upload .filelist li p.progress span {
|
||||
display: none;
|
||||
overflow: hidden;
|
||||
width: 0;
|
||||
height: 100%;
|
||||
background: #1483d8 url(./images/progress.png) repeat-x;
|
||||
|
||||
-webit-transition: width 200ms linear;
|
||||
-moz-transition: width 200ms linear;
|
||||
-o-transition: width 200ms linear;
|
||||
-ms-transition: width 200ms linear;
|
||||
transition: width 200ms linear;
|
||||
|
||||
-webkit-animation: progressmove 2s linear infinite;
|
||||
-moz-animation: progressmove 2s linear infinite;
|
||||
-o-animation: progressmove 2s linear infinite;
|
||||
-ms-animation: progressmove 2s linear infinite;
|
||||
animation: progressmove 2s linear infinite;
|
||||
|
||||
-webkit-transform: translateZ(0);
|
||||
}
|
||||
|
||||
@-webkit-keyframes progressmove {
|
||||
0% {
|
||||
background-position: 0 0;
|
||||
}
|
||||
100% {
|
||||
background-position: 17px 0;
|
||||
}
|
||||
}
|
||||
|
||||
@-moz-keyframes progressmove {
|
||||
0% {
|
||||
background-position: 0 0;
|
||||
}
|
||||
100% {
|
||||
background-position: 17px 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes progressmove {
|
||||
0% {
|
||||
background-position: 0 0;
|
||||
}
|
||||
100% {
|
||||
background-position: 17px 0;
|
||||
}
|
||||
}
|
||||
|
||||
#upload .filelist li p.imgWrap {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
line-height: 113px;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
width: 113px;
|
||||
height: 113px;
|
||||
|
||||
-webkit-transform-origin: 50% 50%;
|
||||
-moz-transform-origin: 50% 50%;
|
||||
-o-transform-origin: 50% 50%;
|
||||
-ms-transform-origin: 50% 50%;
|
||||
transform-origin: 50% 50%;
|
||||
|
||||
-webit-transition: 200ms ease-out;
|
||||
-moz-transition: 200ms ease-out;
|
||||
-o-transition: 200ms ease-out;
|
||||
-ms-transition: 200ms ease-out;
|
||||
transition: 200ms ease-out;
|
||||
}
|
||||
|
||||
#upload .filelist li img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#upload .filelist li p.error {
|
||||
background: #f43838;
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
width: 100%;
|
||||
z-index: 100;
|
||||
display:none;
|
||||
}
|
||||
|
||||
#upload .filelist li .success {
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
height: 40px;
|
||||
width: 100%;
|
||||
z-index: 200;
|
||||
background: url(./images/success.png) no-repeat right bottom;
|
||||
background: url(./images/success.gif) no-repeat right bottom \9;
|
||||
}
|
||||
|
||||
#upload .filelist li.filePickerBlock {
|
||||
width: 113px;
|
||||
height: 113px;
|
||||
background: url(./images/image.png) no-repeat center 12px;
|
||||
border: 1px solid #eeeeee;
|
||||
border-radius: 0;
|
||||
}
|
||||
#upload .filelist li.filePickerBlock div.webuploader-pick {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
opacity: 0;
|
||||
background: none;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
#upload .filelist div.file-panel {
|
||||
position: absolute;
|
||||
height: 0;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#80000000', endColorstr='#80000000') \0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
width: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
overflow: hidden;
|
||||
z-index: 300;
|
||||
}
|
||||
|
||||
#upload .filelist div.file-panel span {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: inline;
|
||||
float: right;
|
||||
text-indent: -9999px;
|
||||
overflow: hidden;
|
||||
background: url(./images/icons.png) no-repeat;
|
||||
background: url(./images/icons.gif) no-repeat \9;
|
||||
margin: 5px 1px 1px;
|
||||
cursor: pointer;
|
||||
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
#upload .filelist div.file-panel span.rotateLeft {
|
||||
display:none;
|
||||
background-position: 0 -24px;
|
||||
}
|
||||
|
||||
#upload .filelist div.file-panel span.rotateLeft:hover {
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
#upload .filelist div.file-panel span.rotateRight {
|
||||
display:none;
|
||||
background-position: -24px -24px;
|
||||
}
|
||||
|
||||
#upload .filelist div.file-panel span.rotateRight:hover {
|
||||
background-position: -24px 0;
|
||||
}
|
||||
|
||||
#upload .filelist div.file-panel span.cancel {
|
||||
background-position: -48px -24px;
|
||||
}
|
||||
|
||||
#upload .filelist div.file-panel span.cancel:hover {
|
||||
background-position: -48px 0;
|
||||
}
|
||||
|
||||
#upload .statusBar {
|
||||
height: 45px;
|
||||
border-bottom: 1px solid #dadada;
|
||||
margin: 0 10px;
|
||||
padding: 0;
|
||||
line-height: 45px;
|
||||
vertical-align: middle;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#upload .statusBar .progress {
|
||||
border: 1px solid #1483d8;
|
||||
width: 198px;
|
||||
background: #fff;
|
||||
height: 18px;
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
display: none;
|
||||
text-align: center;
|
||||
line-height: 18px;
|
||||
color: #6dbfff;
|
||||
margin: 0 10px 0 0;
|
||||
}
|
||||
#upload .statusBar .progress span.percentage {
|
||||
width: 0;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
background: #1483d8;
|
||||
position: absolute;
|
||||
}
|
||||
#upload .statusBar .progress span.text {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
#upload .statusBar .info {
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
#upload .statusBar .btns {
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
right: 0;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
#filePickerBtn {
|
||||
display: inline-block;
|
||||
float: left;
|
||||
}
|
||||
#upload .statusBar .btns .webuploader-pick,
|
||||
#upload .statusBar .btns .uploadBtn,
|
||||
#upload .statusBar .btns .uploadBtn.state-uploading,
|
||||
#upload .statusBar .btns .uploadBtn.state-paused {
|
||||
background: #ffffff;
|
||||
border: 1px solid #cfcfcf;
|
||||
color: #565656;
|
||||
padding: 0 18px;
|
||||
display: inline-block;
|
||||
border-radius: 3px;
|
||||
margin-left: 10px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
float: left;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
#upload .statusBar .btns .webuploader-pick-hover,
|
||||
#upload .statusBar .btns .uploadBtn:hover,
|
||||
#upload .statusBar .btns .uploadBtn.state-uploading:hover,
|
||||
#upload .statusBar .btns .uploadBtn.state-paused:hover {
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
#upload .statusBar .btns .uploadBtn,
|
||||
#upload .statusBar .btns .uploadBtn.state-paused{
|
||||
background: #00b7ee;
|
||||
color: #fff;
|
||||
border-color: transparent;
|
||||
}
|
||||
#upload .statusBar .btns .uploadBtn:hover,
|
||||
#upload .statusBar .btns .uploadBtn.state-paused:hover{
|
||||
background: #00a2d4;
|
||||
}
|
||||
|
||||
#upload .statusBar .btns .uploadBtn.disabled {
|
||||
pointer-events: none;
|
||||
filter:alpha(opacity=60);
|
||||
-moz-opacity:0.6;
|
||||
-khtml-opacity: 0.6;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 图片管理样式 */
|
||||
#online {
|
||||
width: 100%;
|
||||
height: 336px;
|
||||
padding: 10px 0 0 0;
|
||||
}
|
||||
#online #imageList{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
position: relative;
|
||||
}
|
||||
#online ul {
|
||||
display: block;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
#online li {
|
||||
float: left;
|
||||
display: block;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
width: 113px;
|
||||
height: 113px;
|
||||
margin: 0 0 9px 9px;
|
||||
*margin: 0 0 6px 6px;
|
||||
background-color: #eee;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
}
|
||||
#online li.clearFloat {
|
||||
float: none;
|
||||
clear: both;
|
||||
display: block;
|
||||
width:0;
|
||||
height:0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
#online li img {
|
||||
cursor: pointer;
|
||||
}
|
||||
#online li .icon {
|
||||
cursor: pointer;
|
||||
width: 113px;
|
||||
height: 113px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
border: 0;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
#online li .icon:hover {
|
||||
width: 107px;
|
||||
height: 107px;
|
||||
border: 3px solid #1094fa;
|
||||
}
|
||||
#online li.selected .icon {
|
||||
background-image: url(images/success.png);
|
||||
background-image: url(images/success.gif)\9;
|
||||
background-position: 75px 75px;
|
||||
}
|
||||
#online li.selected .icon:hover {
|
||||
width: 107px;
|
||||
height: 107px;
|
||||
border: 3px solid #1094fa;
|
||||
background-position: 72px 72px;
|
||||
}
|
||||
|
||||
|
||||
/* 图片搜索样式 */
|
||||
#search .searchBar {
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
margin: 10px 0 5px 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#search input.text{
|
||||
width: 150px;
|
||||
padding: 3px 6px;
|
||||
font-size: 14px;
|
||||
line-height: 1.42857143;
|
||||
color: #555;
|
||||
background-color: #fff;
|
||||
background-image: none;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
||||
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
||||
}
|
||||
#search input.text:focus {
|
||||
border-color: #66afe9;
|
||||
outline: 0;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
|
||||
}
|
||||
#search input.searchTxt {
|
||||
margin-left:5px;
|
||||
padding-left: 5px;
|
||||
background: #FFF;
|
||||
width: 300px;
|
||||
*width: 260px;
|
||||
height: 21px;
|
||||
line-height: 21px;
|
||||
float: left;
|
||||
dislay: block;
|
||||
}
|
||||
|
||||
#search .searchType {
|
||||
width: 65px;
|
||||
height: 28px;
|
||||
padding:0;
|
||||
line-height: 28px;
|
||||
border: 1px solid #d7d7d7;
|
||||
border-radius: 0;
|
||||
vertical-align: top;
|
||||
margin-left: 5px;
|
||||
float: left;
|
||||
dislay: block;
|
||||
}
|
||||
|
||||
#search #searchBtn,
|
||||
#search #searchReset {
|
||||
display: inline-block;
|
||||
margin-bottom: 0;
|
||||
margin-right: 5px;
|
||||
padding: 4px 10px;
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
background-image: none;
|
||||
border: 1px solid transparent;
|
||||
white-space: nowrap;
|
||||
font-size: 14px;
|
||||
border-radius: 4px;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
vertical-align: top;
|
||||
float: right;
|
||||
}
|
||||
|
||||
#search #searchBtn {
|
||||
color: white;
|
||||
border-color: #285e8e;
|
||||
background-color: #3b97d7;
|
||||
}
|
||||
#search #searchReset {
|
||||
color: #333;
|
||||
border-color: #ccc;
|
||||
background-color: #fff;
|
||||
}
|
||||
#search #searchBtn:hover {
|
||||
background-color: #3276b1;
|
||||
}
|
||||
#search #searchReset:hover {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
#search .msg {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
#search .searchList{
|
||||
width: 100%;
|
||||
height: 300px;
|
||||
overflow: hidden;
|
||||
clear: both;
|
||||
}
|
||||
#search .searchList ul{
|
||||
margin:0;
|
||||
padding:0;
|
||||
list-style:none;
|
||||
clear: both;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
zoom: 1;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#search .searchList li {
|
||||
list-style:none;
|
||||
float: left;
|
||||
display: block;
|
||||
width: 115px;
|
||||
margin: 5px 10px 5px 20px;
|
||||
*margin: 5px 10px 5px 15px;
|
||||
padding:0;
|
||||
font-size: 12px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
|
||||
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
|
||||
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
|
||||
position: relative;
|
||||
vertical-align: top;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
filter: alpha(Opacity=100);
|
||||
-moz-opacity: 1;
|
||||
opacity: 1;
|
||||
border: 2px solid #eee;
|
||||
}
|
||||
|
||||
#search .searchList li.selected {
|
||||
filter: alpha(Opacity=40);
|
||||
-moz-opacity: 0.4;
|
||||
opacity: 0.4;
|
||||
border: 2px solid #00a0e9;
|
||||
}
|
||||
|
||||
#search .searchList li p {
|
||||
background-color: #eee;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
width:100%;
|
||||
height:115px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#search .searchList li p img {
|
||||
cursor: pointer;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
#search .searchList li a {
|
||||
color: #999;
|
||||
border-top: 1px solid #F2F2F2;
|
||||
background: #FAFAFA;
|
||||
text-align: center;
|
||||
display: block;
|
||||
padding: 0 5px;
|
||||
width: 105px;
|
||||
height:32px;
|
||||
line-height:32px;
|
||||
white-space:nowrap;
|
||||
text-overflow:ellipsis;
|
||||
text-decoration: none;
|
||||
overflow: hidden;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
#search .searchList a:hover {
|
||||
text-decoration: underline;
|
||||
color: #333;
|
||||
}
|
||||
#search .searchList .clearFloat{
|
||||
clear: both;
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ueditor图片对话框</title>
|
||||
<script type="text/javascript" src="../internal.js"></script>
|
||||
|
||||
<!-- jquery -->
|
||||
<script type="text/javascript" src="../../third-party/jquery-1.10.2.min.js"></script>
|
||||
|
||||
<!-- webuploader -->
|
||||
<script src="../../third-party/webuploader/webuploader.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../third-party/webuploader/webuploader.css">
|
||||
|
||||
<!-- image dialog -->
|
||||
<link rel="stylesheet" href="image.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="wrapper">
|
||||
<div id="tabhead" class="tabhead">
|
||||
<!--xlz去掉线上上传图片的功能-->
|
||||
<!-- <span class="tab" data-content-id="remote"><var id="lang_tab_remote"></var></span>-->
|
||||
<span class="tab focus" data-content-id="upload"><var id="lang_tab_upload"></var></span>
|
||||
<!--<span class="tab" data-content-id="online"><var id="lang_tab_online"></var></span>
|
||||
<span class="tab" data-content-id="search"><var id="lang_tab_search"></var></span>-->
|
||||
</div>
|
||||
<div class="alignBar">
|
||||
<label class="algnLabel"><var id="lang_input_align"></var></label>
|
||||
<span id="alignIcon">
|
||||
<span id="noneAlign" class="none-align focus" data-align="none"></span>
|
||||
<span id="leftAlign" class="left-align" data-align="left"></span>
|
||||
<span id="rightAlign" class="right-align" data-align="right"></span>
|
||||
<span id="centerAlign" class="center-align" data-align="center"></span>
|
||||
</span>
|
||||
<input id="align" name="align" type="hidden" value="none"/>
|
||||
</div>
|
||||
<div id="tabbody" class="tabbody">
|
||||
|
||||
<!-- 远程图片 -->
|
||||
<div id="remote" class="panel">
|
||||
<div class="top">
|
||||
<div class="row">
|
||||
<label for="url"><var id="lang_input_url"></var></label>
|
||||
<span><input class="text" id="url" type="text"/></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="left">
|
||||
<div class="row">
|
||||
<label><var id="lang_input_size"></var></label>
|
||||
<span><var id="lang_input_width"> </var><input class="text" type="text" id="width"/>px </span>
|
||||
<span><var id="lang_input_height"> </var><input class="text" type="text" id="height"/>px </span>
|
||||
<span><input id="lock" type="checkbox" disabled="disabled"><span id="lockicon"></span></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label><var id="lang_input_border"></var></label>
|
||||
<span><input class="text" type="text" id="border"/>px </span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label><var id="lang_input_vhspace"></var></label>
|
||||
<span><input class="text" type="text" id="vhSpace"/>px </span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label><var id="lang_input_title"></var></label>
|
||||
<span><input class="text" type="text" id="title"/></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right"><div id="preview"></div></div>
|
||||
</div>
|
||||
|
||||
<!-- 上传图片 -->
|
||||
<div id="upload" class="panel focus">
|
||||
<div id="queueList" class="queueList">
|
||||
<div class="statusBar element-invisible">
|
||||
<div class="progress">
|
||||
<span class="text">0%</span>
|
||||
<span class="percentage"></span>
|
||||
</div><div class="info"></div>
|
||||
<div class="btns">
|
||||
<div id="filePickerBtn"></div>
|
||||
<div class="uploadBtn"><var id="lang_start_upload"></var></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="dndArea" class="placeholder">
|
||||
<div class="filePickerContainer">
|
||||
<div id="filePickerReady"></div>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="filelist element-invisible">
|
||||
<li id="filePickerBlock" class="filePickerBlock"></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 在线图片 -->
|
||||
<div id="online" class="panel">
|
||||
<div id="imageList"><var id="lang_imgLoading"></var></div>
|
||||
</div>
|
||||
|
||||
<!-- 搜索图片 -->
|
||||
<div id="search" class="panel">
|
||||
<div class="searchBar">
|
||||
<input id="searchTxt" class="searchTxt text" type="text" />
|
||||
<select id="searchType" class="searchType">
|
||||
<option value="&s=4&z=0"></option>
|
||||
<option value="&s=1&z=19"></option>
|
||||
<option value="&s=2&z=0"></option>
|
||||
<option value="&s=3&z=0"></option>
|
||||
</select>
|
||||
<input id="searchReset" type="button" />
|
||||
<input id="searchBtn" type="button" />
|
||||
</div>
|
||||
<div id="searchList" class="searchList"><ul id="searchListUl"></ul></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="image.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 453 B |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 445 B |
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1,81 @@
|
||||
(function () {
|
||||
var parent = window.parent;
|
||||
//dialog对象
|
||||
dialog = parent.$EDITORUI[window.frameElement.id.replace( /_iframe$/, '' )];
|
||||
//当前打开dialog的编辑器实例
|
||||
editor = dialog.editor;
|
||||
|
||||
UE = parent.UE;
|
||||
|
||||
domUtils = UE.dom.domUtils;
|
||||
|
||||
utils = UE.utils;
|
||||
|
||||
browser = UE.browser;
|
||||
|
||||
ajax = UE.ajax;
|
||||
|
||||
$G = function ( id ) {
|
||||
return document.getElementById( id )
|
||||
};
|
||||
//focus元素
|
||||
$focus = function ( node ) {
|
||||
setTimeout( function () {
|
||||
if ( browser.ie ) {
|
||||
var r = node.createTextRange();
|
||||
r.collapse( false );
|
||||
r.select();
|
||||
} else {
|
||||
node.focus()
|
||||
}
|
||||
}, 0 )
|
||||
};
|
||||
utils.loadFile(document,{
|
||||
href: "../themes/default/dialogbase.css?cache="+Math.random(),//xlz原来的路径写错了去掉了一个../
|
||||
tag:"link",
|
||||
type:"text/css",
|
||||
// rel:"stylesheet"
|
||||
});
|
||||
lang = editor.getLang(dialog.className.split( "-" )[2]);
|
||||
if(lang){
|
||||
domUtils.on(window,'load',function () {
|
||||
|
||||
var langImgPath = editor.options.langPath + editor.options.lang + "/images/";
|
||||
//针对静态资源
|
||||
for ( var i in lang["static"] ) {
|
||||
var dom = $G( i );
|
||||
if(!dom) continue;
|
||||
var tagName = dom.tagName,
|
||||
content = lang["static"][i];
|
||||
if(content.src){
|
||||
//clone
|
||||
content = utils.extend({},content,false);
|
||||
content.src = langImgPath + content.src;
|
||||
}
|
||||
if(content.style){
|
||||
content = utils.extend({},content,false);
|
||||
content.style = content.style.replace(/url\s*\(/g,"url(" + langImgPath)
|
||||
}
|
||||
switch ( tagName.toLowerCase() ) {
|
||||
case "var":
|
||||
dom.parentNode.replaceChild( document.createTextNode( content ), dom );
|
||||
break;
|
||||
case "select":
|
||||
var ops = dom.options;
|
||||
for ( var j = 0, oj; oj = ops[j]; ) {
|
||||
oj.innerHTML = content.options[j++];
|
||||
}
|
||||
for ( var p in content ) {
|
||||
p != "options" && dom.setAttribute( p, content[p] );
|
||||
}
|
||||
break;
|
||||
default :
|
||||
domUtils.setAttributes( dom, content);
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
})();
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<style>
|
||||
html,body{
|
||||
height:100%;
|
||||
width:100%;
|
||||
padding:0;
|
||||
margin:0;
|
||||
}
|
||||
#preview{
|
||||
width:100%;
|
||||
height:100%;
|
||||
padding:0;
|
||||
margin:0;
|
||||
}
|
||||
#preview *{font-family:sans-serif;font-size:16px;}
|
||||
</style>
|
||||
<script type="text/javascript" src="../internal.js"></script>
|
||||
<script src="../../ueditor.parse.min.js"></script>
|
||||
<title></title>
|
||||
</head>
|
||||
<body class="view">
|
||||
<div id="preview" style="margin:8px">
|
||||
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
document.getElementById('preview').innerHTML = editor.getContent();
|
||||
uParse('#preview',{
|
||||
rootPath : '../../',
|
||||
chartContainerHeight:500
|
||||
})
|
||||
dialog.oncancel = function(){
|
||||
document.getElementById('preview').innerHTML = '';
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 304 B |
@@ -0,0 +1,84 @@
|
||||
body{
|
||||
overflow: hidden;
|
||||
width: 540px;
|
||||
}
|
||||
.wrapper {
|
||||
margin: 10px auto 0;
|
||||
font-size: 12px;
|
||||
overflow: hidden;
|
||||
width: 520px;
|
||||
height: 315px;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.wrapper .left {
|
||||
float: left;
|
||||
margin-left: 10px;;
|
||||
}
|
||||
|
||||
.wrapper .right {
|
||||
float: right;
|
||||
border-left: 2px dotted #EDEDED;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.section {
|
||||
margin-bottom: 15px;
|
||||
width: 240px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.section h3 {
|
||||
font-weight: bold;
|
||||
padding: 5px 0;
|
||||
margin-bottom: 10px;
|
||||
border-bottom: 1px solid #EDEDED;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.section ul {
|
||||
list-style: none;
|
||||
overflow: hidden;
|
||||
clear: both;
|
||||
|
||||
}
|
||||
|
||||
.section li {
|
||||
float: left;
|
||||
width: 120px;;
|
||||
}
|
||||
|
||||
.section .tone {
|
||||
width: 80px;;
|
||||
}
|
||||
|
||||
.section .preview {
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.section .preview table {
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.section .preview caption {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.section .preview td {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
.section .preview th {
|
||||
border-style: solid;
|
||||
border-color: #DDD;
|
||||
border-width: 2px 1px 1px 1px;
|
||||
height: 22px;
|
||||
background-color: #F7F7F7;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<script type="text/javascript" src="../internal.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="edittable.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<div class="left">
|
||||
<div class="section">
|
||||
<h3><var id="lang_tableStyle"></var></h3>
|
||||
<ul>
|
||||
<li>
|
||||
<label onselectstart="return false"><input type="checkbox" id="J_title" name="style"/><var id="lang_insertTitle"></var></label>
|
||||
</li>
|
||||
<li>
|
||||
<label onselectstart="return false"><input type="checkbox" id="J_titleCol" name="style"/><var id="lang_insertTitleCol"></var></label>
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>
|
||||
<label onselectstart="return false"><input type="checkbox" id="J_caption" name="style"/><var id="lang_insertCaption"></var></label>
|
||||
</li>
|
||||
<li>
|
||||
<label onselectstart="return false"><input type="checkbox" id="J_sorttable" name="style"/><var id="lang_orderbycontent"></var></label>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h3><var id="lang_tableSize"></var></h3>
|
||||
<ul>
|
||||
<li>
|
||||
<label><input type="radio" id="J_autoSizeContent" name="size"/><var id="lang_autoSizeContent"></var></label>
|
||||
</li>
|
||||
<li>
|
||||
<label><input type="radio" id="J_autoSizePage" name="size"/><var id="lang_autoSizePage"></var></label>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h3><var id="lang_borderStyle"></var></h3>
|
||||
<ul>
|
||||
<li>
|
||||
<span><var id="lang_color"></var></span>
|
||||
<input type="text" class="tone" id="J_tone" readonly='readonly' />
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="section">
|
||||
<h3><var id="lang_example"></var></h3>
|
||||
<div class="preview" id="J_preview">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="edittable.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,237 @@
|
||||
/**
|
||||
* Created with JetBrains PhpStorm.
|
||||
* User: xuheng
|
||||
* Date: 12-12-19
|
||||
* Time: 下午4:55
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
(function () {
|
||||
var title = $G("J_title"),
|
||||
titleCol = $G("J_titleCol"),
|
||||
caption = $G("J_caption"),
|
||||
sorttable = $G("J_sorttable"),
|
||||
autoSizeContent = $G("J_autoSizeContent"),
|
||||
autoSizePage = $G("J_autoSizePage"),
|
||||
tone = $G("J_tone"),
|
||||
me,
|
||||
preview = $G("J_preview");
|
||||
|
||||
var editTable = function () {
|
||||
me = this;
|
||||
me.init();
|
||||
};
|
||||
editTable.prototype = {
|
||||
init:function () {
|
||||
var colorPiker = new UE.ui.ColorPicker({
|
||||
editor:editor
|
||||
}),
|
||||
colorPop = new UE.ui.Popup({
|
||||
editor:editor,
|
||||
content:colorPiker
|
||||
});
|
||||
|
||||
title.checked = editor.queryCommandState("inserttitle") == -1;
|
||||
titleCol.checked = editor.queryCommandState("inserttitlecol") == -1;
|
||||
caption.checked = editor.queryCommandState("insertcaption") == -1;
|
||||
sorttable.checked = editor.queryCommandState("enablesort") == 1;
|
||||
|
||||
var enablesortState = editor.queryCommandState("enablesort"),
|
||||
disablesortState = editor.queryCommandState("disablesort");
|
||||
|
||||
sorttable.checked = !!(enablesortState < 0 && disablesortState >=0);
|
||||
sorttable.disabled = !!(enablesortState < 0 && disablesortState < 0);
|
||||
sorttable.title = enablesortState < 0 && disablesortState < 0 ? lang.errorMsg:'';
|
||||
|
||||
me.createTable(title.checked, titleCol.checked, caption.checked);
|
||||
me.setAutoSize();
|
||||
me.setColor(me.getColor());
|
||||
|
||||
domUtils.on(title, "click", me.titleHanler);
|
||||
domUtils.on(titleCol, "click", me.titleColHanler);
|
||||
domUtils.on(caption, "click", me.captionHanler);
|
||||
domUtils.on(sorttable, "click", me.sorttableHanler);
|
||||
domUtils.on(autoSizeContent, "click", me.autoSizeContentHanler);
|
||||
domUtils.on(autoSizePage, "click", me.autoSizePageHanler);
|
||||
|
||||
domUtils.on(tone, "click", function () {
|
||||
colorPop.showAnchor(tone);
|
||||
});
|
||||
domUtils.on(document, 'mousedown', function () {
|
||||
colorPop.hide();
|
||||
});
|
||||
colorPiker.addListener("pickcolor", function () {
|
||||
me.setColor(arguments[1]);
|
||||
colorPop.hide();
|
||||
});
|
||||
colorPiker.addListener("picknocolor", function () {
|
||||
me.setColor("");
|
||||
colorPop.hide();
|
||||
});
|
||||
},
|
||||
|
||||
createTable:function (hasTitle, hasTitleCol, hasCaption) {
|
||||
var arr = [],
|
||||
sortSpan = '<span>^</span>';
|
||||
arr.push("<table id='J_example'>");
|
||||
if (hasCaption) {
|
||||
arr.push("<caption>" + lang.captionName + "</caption>")
|
||||
}
|
||||
if (hasTitle) {
|
||||
arr.push("<tr>");
|
||||
if(hasTitleCol) { arr.push("<th>" + lang.titleName + "</th>"); }
|
||||
for (var j = 0; j < 5; j++) {
|
||||
arr.push("<th>" + lang.titleName + "</th>");
|
||||
}
|
||||
arr.push("</tr>");
|
||||
}
|
||||
for (var i = 0; i < 6; i++) {
|
||||
arr.push("<tr>");
|
||||
if(hasTitleCol) { arr.push("<th>" + lang.titleName + "</th>") }
|
||||
for (var k = 0; k < 5; k++) {
|
||||
arr.push("<td>" + lang.cellsName + "</td>")
|
||||
}
|
||||
arr.push("</tr>");
|
||||
}
|
||||
arr.push("</table>");
|
||||
preview.innerHTML = arr.join("");
|
||||
this.updateSortSpan();
|
||||
},
|
||||
titleHanler:function () {
|
||||
var example = $G("J_example"),
|
||||
frg=document.createDocumentFragment(),
|
||||
color = domUtils.getComputedStyle(domUtils.getElementsByTagName(example, "td")[0], "border-color"),
|
||||
colCount = example.rows[0].children.length;
|
||||
|
||||
if (title.checked) {
|
||||
example.insertRow(0);
|
||||
for (var i = 0, node; i < colCount; i++) {
|
||||
node = document.createElement("th");
|
||||
node.innerHTML = lang.titleName;
|
||||
frg.appendChild(node);
|
||||
}
|
||||
example.rows[0].appendChild(frg);
|
||||
|
||||
} else {
|
||||
domUtils.remove(example.rows[0]);
|
||||
}
|
||||
me.setColor(color);
|
||||
me.updateSortSpan();
|
||||
},
|
||||
titleColHanler:function () {
|
||||
var example = $G("J_example"),
|
||||
color = domUtils.getComputedStyle(domUtils.getElementsByTagName(example, "td")[0], "border-color"),
|
||||
colArr = example.rows,
|
||||
colCount = colArr.length;
|
||||
|
||||
if (titleCol.checked) {
|
||||
for (var i = 0, node; i < colCount; i++) {
|
||||
node = document.createElement("th");
|
||||
node.innerHTML = lang.titleName;
|
||||
colArr[i].insertBefore(node, colArr[i].children[0]);
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < colCount; i++) {
|
||||
domUtils.remove(colArr[i].children[0]);
|
||||
}
|
||||
}
|
||||
me.setColor(color);
|
||||
me.updateSortSpan();
|
||||
},
|
||||
captionHanler:function () {
|
||||
var example = $G("J_example");
|
||||
if (caption.checked) {
|
||||
var row = document.createElement('caption');
|
||||
row.innerHTML = lang.captionName;
|
||||
example.insertBefore(row, example.firstChild);
|
||||
} else {
|
||||
domUtils.remove(domUtils.getElementsByTagName(example, 'caption')[0]);
|
||||
}
|
||||
},
|
||||
sorttableHanler:function(){
|
||||
me.updateSortSpan();
|
||||
},
|
||||
autoSizeContentHanler:function () {
|
||||
var example = $G("J_example");
|
||||
example.removeAttribute("width");
|
||||
},
|
||||
autoSizePageHanler:function () {
|
||||
var example = $G("J_example");
|
||||
var tds = example.getElementsByTagName(example, "td");
|
||||
utils.each(tds, function (td) {
|
||||
td.removeAttribute("width");
|
||||
});
|
||||
example.setAttribute('width', '100%');
|
||||
},
|
||||
updateSortSpan: function(){
|
||||
var example = $G("J_example"),
|
||||
row = example.rows[0];
|
||||
|
||||
var spans = domUtils.getElementsByTagName(example,"span");
|
||||
utils.each(spans,function(span){
|
||||
span.parentNode.removeChild(span);
|
||||
});
|
||||
if (sorttable.checked) {
|
||||
utils.each(row.cells, function(cell, i){
|
||||
var span = document.createElement("span");
|
||||
span.innerHTML = "^";
|
||||
cell.appendChild(span);
|
||||
});
|
||||
}
|
||||
},
|
||||
getColor:function () {
|
||||
var start = editor.selection.getStart(), color,
|
||||
cell = domUtils.findParentByTagName(start, ["td", "th", "caption"], true);
|
||||
color = cell && domUtils.getComputedStyle(cell, "border-color");
|
||||
if (!color) color = "#DDDDDD";
|
||||
return color;
|
||||
},
|
||||
setColor:function (color) {
|
||||
var example = $G("J_example"),
|
||||
arr = domUtils.getElementsByTagName(example, "td").concat(
|
||||
domUtils.getElementsByTagName(example, "th"),
|
||||
domUtils.getElementsByTagName(example, "caption")
|
||||
);
|
||||
|
||||
tone.value = color;
|
||||
utils.each(arr, function (node) {
|
||||
node.style.borderColor = color;
|
||||
});
|
||||
|
||||
},
|
||||
setAutoSize:function () {
|
||||
var me = this;
|
||||
autoSizePage.checked = true;
|
||||
me.autoSizePageHanler();
|
||||
}
|
||||
};
|
||||
|
||||
new editTable;
|
||||
|
||||
dialog.onok = function () {
|
||||
editor.__hasEnterExecCommand = true;
|
||||
|
||||
var checks = {
|
||||
title:"inserttitle deletetitle",
|
||||
titleCol:"inserttitlecol deletetitlecol",
|
||||
caption:"insertcaption deletecaption",
|
||||
sorttable:"enablesort disablesort"
|
||||
};
|
||||
editor.fireEvent('saveScene');
|
||||
for(var i in checks){
|
||||
var cmds = checks[i].split(" "),
|
||||
input = $G("J_" + i);
|
||||
if(input["checked"]){
|
||||
editor.queryCommandState(cmds[0])!=-1 &&editor.execCommand(cmds[0]);
|
||||
}else{
|
||||
editor.queryCommandState(cmds[1])!=-1 &&editor.execCommand(cmds[1]);
|
||||
}
|
||||
}
|
||||
|
||||
editor.execCommand("edittable", tone.value);
|
||||
autoSizeContent.checked ?editor.execCommand('adaptbytext') : "";
|
||||
autoSizePage.checked ? editor.execCommand("adaptbywindow") : "";
|
||||
editor.fireEvent('saveScene');
|
||||
|
||||
editor.__hasEnterExecCommand = false;
|
||||
};
|
||||
})();
|
||||
@@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<script type="text/javascript" src="../internal.js"></script>
|
||||
<style type="text/css">
|
||||
.section {
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.section input {
|
||||
margin-left: 5px;
|
||||
width: 70px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="section">
|
||||
<span><var id="lang_tdBkColor"></var></span>
|
||||
<input type="text" id="J_tone"/>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var tone = $G("J_tone"),
|
||||
colorPiker = new UE.ui.ColorPicker({
|
||||
editor:editor
|
||||
}),
|
||||
colorPop = new UE.ui.Popup({
|
||||
editor:editor,
|
||||
content:colorPiker
|
||||
});
|
||||
domUtils.on(tone, "click", function () {
|
||||
colorPop.showAnchor(tone);
|
||||
});
|
||||
domUtils.on(document, 'mousedown', function () {
|
||||
colorPop.hide();
|
||||
});
|
||||
colorPiker.addListener("pickcolor", function () {
|
||||
tone.value = arguments[1];
|
||||
colorPop.hide();
|
||||
});
|
||||
colorPiker.addListener("picknocolor", function () {
|
||||
tone.value="";
|
||||
colorPop.hide();
|
||||
});
|
||||
dialog.onok=function(){
|
||||
editor.execCommand("edittd",tone.value);
|
||||
};
|
||||
|
||||
var start = editor.selection.getStart(),
|
||||
cell = start && domUtils.findParentByTagName(start, ["td", "th"], true);
|
||||
if(cell){
|
||||
var color = domUtils.getComputedStyle(cell,'background-color');
|
||||
if(/^#/.test(color)){
|
||||
tone.value = color
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>表格删除提示</title>
|
||||
<script type="text/javascript" src="../internal.js"></script>
|
||||
<style type="text/css">
|
||||
.section {
|
||||
width: 200px;
|
||||
margin: 10px auto 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.item {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="section">
|
||||
<div class="item">
|
||||
<label><input type="radio" id="J_delRow" name="cmd" checked/><var id="lang_delRow"></var></label>
|
||||
</div>
|
||||
<div class="item">
|
||||
<label><input type="radio" id="J_delCol" name="cmd"/><var id="lang_delCol"></var></label>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
dialog.onok = function () {
|
||||
$G("J_delRow").checked ? editor.execCommand("deleterow") : editor.execCommand("deletecol");
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,74 @@
|
||||
UE.registerUI('kityformula', function(editor, uiname){
|
||||
|
||||
// 创建dialog
|
||||
var kfDialog = new UE.ui.Dialog({
|
||||
|
||||
// 指定弹出层路径
|
||||
iframeUrl: editor.options.UEDITOR_HOME_URL + 'kityformula-plugin/kityFormulaDialog.html',
|
||||
// 编辑器实例
|
||||
editor: editor,
|
||||
// dialog 名称
|
||||
name: uiname,
|
||||
// dialog 标题
|
||||
title: '插入公式 ',
|
||||
|
||||
// dialog 外围 css
|
||||
cssRules: 'width:783px; height: 386px;',
|
||||
|
||||
//如果给出了buttons就代表dialog有确定和取消
|
||||
buttons:[
|
||||
{
|
||||
className:'edui-okbutton',
|
||||
label:'确定',
|
||||
onclick:function () {
|
||||
kfDialog.close(true);
|
||||
}
|
||||
},
|
||||
{
|
||||
className:'edui-cancelbutton',
|
||||
label:'取消',
|
||||
onclick:function () {
|
||||
kfDialog.close(false);
|
||||
}
|
||||
}
|
||||
]});
|
||||
|
||||
editor.ready(function(){
|
||||
UE.utils.cssRule('kfformula', 'img.kfformula{vertical-align: middle;}', editor.document);
|
||||
});
|
||||
|
||||
var iconUrl = editor.options.UEDITOR_HOME_URL + 'kityformula-plugin/kf-icon.png';
|
||||
var tmpLink = document.createElement('a');
|
||||
tmpLink.href = iconUrl;
|
||||
tmpLink.href = tmpLink.href;
|
||||
iconUrl = tmpLink.href;
|
||||
|
||||
var kfBtn = new UE.ui.Button({
|
||||
name:'插入' + uiname,
|
||||
title:'插入公式',
|
||||
//需要添加的额外样式,指定icon图标
|
||||
cssRules :'background: url("' + iconUrl + '") !important',
|
||||
onclick:function () {
|
||||
//渲染dialog
|
||||
kfDialog.render();
|
||||
kfDialog.open();
|
||||
}
|
||||
});
|
||||
|
||||
//当点到编辑内容上时,按钮要做的状态反射
|
||||
editor.addListener('selectionchange', function () {
|
||||
var state = editor.queryCommandState(uiname);
|
||||
if (state == -1) {
|
||||
kfBtn.setDisabled(true);
|
||||
kfBtn.setChecked(false);
|
||||
} else {
|
||||
kfBtn.setDisabled(false);
|
||||
kfBtn.setChecked(state);
|
||||
}
|
||||
});
|
||||
|
||||
return kfBtn;
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
///import core
|
||||
///plugin 编辑器默认的过滤转换机制
|
||||
|
||||
UE.plugins['defaultfilter'] = function () {
|
||||
var me = this;
|
||||
me.setOpt({
|
||||
'allowDivTransToP':true,
|
||||
'disabledTableInTable':true,
|
||||
'rgb2Hex':true
|
||||
});
|
||||
//默认的过滤处理
|
||||
//进入编辑器的内容处理
|
||||
me.addInputRule(function (root) {
|
||||
var allowDivTransToP = this.options.allowDivTransToP;
|
||||
var val;
|
||||
function tdParent(node){
|
||||
while(node && node.type == 'element'){
|
||||
if(node.tagName == 'td'){
|
||||
return true;
|
||||
}
|
||||
node = node.parentNode;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//进行默认的处理
|
||||
root.traversal(function (node) {
|
||||
if (node.type == 'element') {
|
||||
if (!UE.dom.dtd.$cdata[node.tagName] && me.options.autoClearEmptyNode && UE.dom.dtd.$inline[node.tagName] && !UE.dom.dtd.$empty[node.tagName] && (!node.attrs || UE.utils.isEmptyObject(node.attrs))) {
|
||||
if (!node.firstChild()) node.parentNode.removeChild(node);
|
||||
else if (node.tagName == 'span' && (!node.attrs || UE.utils.isEmptyObject(node.attrs))) {
|
||||
node.parentNode.removeChild(node, true)
|
||||
}
|
||||
return;
|
||||
}
|
||||
switch (node.tagName) {
|
||||
case 'style':
|
||||
case 'script':
|
||||
node.setAttr({
|
||||
cdata_tag: node.tagName,
|
||||
cdata_data: (node.innerHTML() || ''),
|
||||
'_ue_custom_node_':'true'
|
||||
});
|
||||
node.tagName = 'div';
|
||||
node.innerHTML('');
|
||||
break;
|
||||
case 'a':
|
||||
if (val = node.getAttr('href')) {
|
||||
node.setAttr('_href', val)
|
||||
}
|
||||
break;
|
||||
case 'img':
|
||||
//todo base64暂时去掉,后边做远程图片上传后,干掉这个
|
||||
// if (val = node.getAttr('src')) {
|
||||
// if (/^data:/.test(val)) {
|
||||
// node.parentNode.removeChild(node);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
node.setAttr('_src', node.getAttr('src'));
|
||||
break;
|
||||
case 'span':
|
||||
if (UE.browser.webkit && (val = node.getStyle('white-space'))) {
|
||||
if (/nowrap|normal/.test(val)) {
|
||||
node.setStyle('white-space', '');
|
||||
if (me.options.autoClearEmptyNode && UE.utils.isEmptyObject(node.attrs)) {
|
||||
node.parentNode.removeChild(node, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
val = node.getAttr('id');
|
||||
if(val && /^_baidu_bookmark_/i.test(val)){
|
||||
node.parentNode.removeChild(node)
|
||||
}
|
||||
break;
|
||||
case 'p':
|
||||
if (val = node.getAttr('align')) {
|
||||
node.setAttr('align');
|
||||
node.setStyle('text-align', val)
|
||||
}
|
||||
//trace:3431
|
||||
// var cssStyle = node.getAttr('style');
|
||||
// if (cssStyle) {
|
||||
// cssStyle = cssStyle.replace(/(margin|padding)[^;]+/g, '');
|
||||
// node.setAttr('style', cssStyle)
|
||||
//
|
||||
// }
|
||||
//p标签不允许嵌套
|
||||
UE.utils.each(node.children,function(n){
|
||||
if(n.type == 'element' && n.tagName == 'p'){
|
||||
var next = n.nextSibling();
|
||||
node.parentNode.insertAfter(n,node);
|
||||
var last = n;
|
||||
while(next){
|
||||
var tmp = next.nextSibling();
|
||||
node.parentNode.insertAfter(next,last);
|
||||
last = next;
|
||||
next = tmp;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (!node.firstChild()) {
|
||||
node.innerHTML(UE.browser.ie ? ' ' : '<br/>')
|
||||
}
|
||||
break;
|
||||
case 'div':
|
||||
if(node.getAttr('cdata_tag')){
|
||||
break;
|
||||
}
|
||||
//针对代码这里不处理插入代码的div
|
||||
val = node.getAttr('class');
|
||||
if(val && /^line number\d+/.test(val)){
|
||||
break;
|
||||
}
|
||||
if(!allowDivTransToP){
|
||||
break;
|
||||
}
|
||||
var tmpNode, p = UE.uNode.createElement('p');
|
||||
while (tmpNode = node.firstChild()) {
|
||||
if (tmpNode.type == 'text' || !UE.dom.UE.dom.dtd.$block[tmpNode.tagName]) {
|
||||
p.appendChild(tmpNode);
|
||||
} else {
|
||||
if (p.firstChild()) {
|
||||
node.parentNode.insertBefore(p, node);
|
||||
p = UE.uNode.createElement('p');
|
||||
} else {
|
||||
node.parentNode.insertBefore(tmpNode, node);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (p.firstChild()) {
|
||||
node.parentNode.insertBefore(p, node);
|
||||
}
|
||||
node.parentNode.removeChild(node);
|
||||
break;
|
||||
case 'dl':
|
||||
node.tagName = 'ul';
|
||||
break;
|
||||
case 'dt':
|
||||
case 'dd':
|
||||
node.tagName = 'li';
|
||||
break;
|
||||
case 'li':
|
||||
var className = node.getAttr('class');
|
||||
if (!className || !/list\-/.test(className)) {
|
||||
node.setAttr()
|
||||
}
|
||||
var tmpNodes = node.getNodesByTagName('ol ul');
|
||||
UE.utils.each(tmpNodes, function (n) {
|
||||
node.parentNode.insertAfter(n, node);
|
||||
});
|
||||
break;
|
||||
case 'td':
|
||||
case 'th':
|
||||
case 'caption':
|
||||
if(!node.children || !node.children.length){
|
||||
node.appendChild(UE.browser.ie11below ? UE.uNode.createText(' ') : UE.uNode.createElement('br'))
|
||||
}
|
||||
break;
|
||||
case 'table':
|
||||
if(me.options.disabledTableInTable && tdParent(node)){
|
||||
node.parentNode.insertBefore(UE.uNode.createText(node.innerText()),node);
|
||||
node.parentNode.removeChild(node)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// if(node.type == 'comment'){
|
||||
// node.parentNode.removeChild(node);
|
||||
// }
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
//从编辑器出去的内容处理
|
||||
me.addOutputRule(function (root) {
|
||||
|
||||
var val;
|
||||
root.traversal(function (node) {
|
||||
if (node.type == 'element') {
|
||||
|
||||
if (me.options.autoClearEmptyNode && UE.dom.dtd.$inline[node.tagName] && !UE.dom.dtd.$empty[node.tagName] && (!node.attrs || UE.utils.isEmptyObject(node.attrs))) {
|
||||
|
||||
if (!node.firstChild()) node.parentNode.removeChild(node);
|
||||
else if (node.tagName == 'span' && (!node.attrs || UE.utils.isEmptyObject(node.attrs))) {
|
||||
node.parentNode.removeChild(node, true)
|
||||
}
|
||||
return;
|
||||
}
|
||||
switch (node.tagName) {
|
||||
case 'div':
|
||||
if (val = node.getAttr('cdata_tag')) {
|
||||
node.tagName = val;
|
||||
node.appendChild(UE.uNode.createText(node.getAttr('cdata_data')));
|
||||
node.setAttr({cdata_tag: '', cdata_data: '','_ue_custom_node_':''});
|
||||
}
|
||||
break;
|
||||
case 'a':
|
||||
if (val = node.getAttr('_href')) {
|
||||
node.setAttr({
|
||||
'href': UE.utils.html(val),
|
||||
'_href': ''
|
||||
})
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 'span':
|
||||
val = node.getAttr('id');
|
||||
if(val && /^_baidu_bookmark_/i.test(val)){
|
||||
node.parentNode.removeChild(node)
|
||||
}
|
||||
//将color的rgb格式转换为#16进制格式
|
||||
if(me.getOpt('rgb2Hex')){
|
||||
var cssStyle = node.getAttr('style');
|
||||
if(cssStyle){
|
||||
node.setAttr('style',cssStyle.replace(/rgba?\(([\d,\s]+)\)/g,function(a,value){
|
||||
var array = value.split(",");
|
||||
if (array.length > 3)
|
||||
return "";
|
||||
value = "#";
|
||||
for (var i = 0, color; color = array[i++];) {
|
||||
color = parseInt(color.replace(/[^\d]/gi, ''), 10).toString(16);
|
||||
value += color.length == 1 ? "0" + color : color;
|
||||
}
|
||||
return value.toUpperCase();
|
||||
|
||||
}))
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'img':
|
||||
if (val = node.getAttr('_src')) {
|
||||
node.setAttr({
|
||||
'src': node.getAttr('_src'),
|
||||
'_src': ''
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* Created by zhangbo21 on 14-9-2.
|
||||
*/
|
||||
/*
|
||||
* getKfContent : 将image的src从base64替换为文件名
|
||||
* param : callback -- 回调函数 其参数为替换之后的内容
|
||||
* return : void
|
||||
* */
|
||||
|
||||
UE.Editor.prototype.getKfContent = function(callback){
|
||||
|
||||
var me = this;
|
||||
var actionUrl = me.getActionUrl(me.getOpt('scrawlActionName')),
|
||||
params = UE.utils.serializeParam(me.queryCommandValue('serverparam')) || '',
|
||||
url = UE.utils.formatUrl(actionUrl + (actionUrl.indexOf('?') == -1 ? '?':'&') + params);
|
||||
|
||||
// 找到所有的base64
|
||||
var count = 0;
|
||||
var imgs =me.body.getElementsByTagName('img');
|
||||
var base64Imgs = [];
|
||||
UE.utils.each(imgs, function(item){
|
||||
var imgType = item.getAttribute('src').match(/^[^;]+/)[0];
|
||||
if ( imgType === 'data:image/png') {
|
||||
base64Imgs.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
if (base64Imgs.length == 0){
|
||||
execCallback();
|
||||
} else {
|
||||
UE.utils.each(base64Imgs, function(item){
|
||||
|
||||
var opt ={};
|
||||
opt[me.getOpt('scrawlFieldName')]= item.getAttribute('src').replace(/^[^,]+,/, '');
|
||||
opt.onsuccess = function(xhr){
|
||||
var json = UE.utils.str2json(xhr.responseText),
|
||||
url = me.options.scrawlUrlPrefix + json.url;
|
||||
|
||||
item.setAttribute('src', url);
|
||||
item.setAttribute('_src', url);
|
||||
|
||||
count++;
|
||||
|
||||
execCallback();
|
||||
}
|
||||
opt.onerror = function(err){
|
||||
console.error(err);
|
||||
count++;
|
||||
|
||||
execCallback();
|
||||
}
|
||||
|
||||
|
||||
UE.ajax.request(url, opt);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function execCallback(){
|
||||
if (count >= base64Imgs.length) {
|
||||
me.sync();
|
||||
callback(me.getContent());
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
@@ -0,0 +1,107 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<link rel="stylesheet" href="kityformula/assets/styles/base.css">
|
||||
<link rel="stylesheet" href="kityformula/assets/styles/ui.css">
|
||||
<link rel="stylesheet" href="kityformula/assets/styles/scrollbar.css">
|
||||
<style>
|
||||
html, body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
.kf-editor {
|
||||
width: 780px;
|
||||
height: 380px;
|
||||
}
|
||||
#loading {
|
||||
height: 32px;
|
||||
width: 340px;
|
||||
line-height: 32px;
|
||||
position: absolute;
|
||||
top: 42%;
|
||||
left: 50%;
|
||||
margin-left: -170px;
|
||||
font-family: arial, "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
|
||||
}
|
||||
#loading img {
|
||||
position: absolute;
|
||||
}
|
||||
#loading p {
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 40px;
|
||||
top: 0px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="kfEditorContainer" class="kf-editor">
|
||||
<div id="tips" class="tips">
|
||||
sorry! Beta版本仅支持IE9及以上版本的浏览器,正式版本将会支持低版本浏览器,谢谢您的关注!
|
||||
</div>
|
||||
</div>
|
||||
<!--页面中一定要引入internal.js为了能直接使用当前打开dialog的实例变量-->
|
||||
<!--internal.js默认是放到dialogs目录下的-->
|
||||
<script type="text/javascript" src="../dialogs/internal.js"></script>
|
||||
|
||||
<script src="kityformula/js/jquery-1.11.0.min.js"></script>
|
||||
<script src="kityformula/js/kitygraph.all.js"></script>
|
||||
<script src="kityformula/js/kity-formula-render.all.js"></script>
|
||||
<script src="kityformula/js/kity-formula-parser.all.min.js"></script>
|
||||
<script src="kityformula/js/kityformula-editor.all.min.js"></script>
|
||||
<script>
|
||||
jQuery( function ($) {
|
||||
|
||||
if ( document.body.addEventListener ) {
|
||||
|
||||
$( "#tips").html('<div id="loading"><img src="kityformula/loading.gif" alt="loading" /><p>正在加载,请耐心等待...</p></div>' );
|
||||
|
||||
var factory = kf.EditorFactory.create( $( "#kfEditorContainer" )[ 0 ], {
|
||||
render: {
|
||||
fontsize: 24
|
||||
},
|
||||
resource: {
|
||||
path: "./kityformula/resource/"
|
||||
}
|
||||
} );
|
||||
|
||||
factory.ready( function ( KFEditor ) {
|
||||
|
||||
$( "#tips").remove();
|
||||
|
||||
// this指向KFEditor
|
||||
var rng = editor.selection.getRange(),
|
||||
img = rng.getClosedNode(),
|
||||
imgLatex = img && $(img).attr('data-latex');
|
||||
|
||||
this.execCommand( "render", imgLatex || "\\placeholder" );
|
||||
this.execCommand( "focus" );
|
||||
|
||||
window.kfe = this;
|
||||
|
||||
} );
|
||||
|
||||
dialog.onok = function(){
|
||||
kfe.execCommand('get.image.data', function(data){
|
||||
var latex = kfe.execCommand('get.source');
|
||||
editor.execCommand('inserthtml', '<img class="kfformula" src="'+ data.img +'" data-latex="' + latex + '" />');
|
||||
dialog.close();
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
$( "#tips").css( "color", "black" );
|
||||
$( "#tips").css( "padding", "10px" );
|
||||
}
|
||||
|
||||
} );
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 925 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 945 B |
|
After Width: | Height: | Size: 1003 B |
|
After Width: | Height: | Size: 926 B |
|
After Width: | Height: | Size: 926 B |
|
After Width: | Height: | Size: 996 B |
|
After Width: | Height: | Size: 926 B |
|
After Width: | Height: | Size: 938 B |
|
After Width: | Height: | Size: 982 B |
|
After Width: | Height: | Size: 994 B |
|
After Width: | Height: | Size: 941 B |
|
After Width: | Height: | Size: 983 B |
|
After Width: | Height: | Size: 988 B |
|
After Width: | Height: | Size: 559 B |
|
After Width: | Height: | Size: 519 B |
|
After Width: | Height: | Size: 317 B |
|
After Width: | Height: | Size: 874 B |
|
After Width: | Height: | Size: 371 B |
|
After Width: | Height: | Size: 305 B |
|
After Width: | Height: | Size: 467 B |
|
After Width: | Height: | Size: 552 B |
|
After Width: | Height: | Size: 239 B |
|
After Width: | Height: | Size: 492 B |
|
After Width: | Height: | Size: 364 B |
|
After Width: | Height: | Size: 516 B |
|
After Width: | Height: | Size: 542 B |
|
After Width: | Height: | Size: 571 B |
|
After Width: | Height: | Size: 573 B |