逐步完成前后端服务器
This commit is contained in:
108
frontend/node_modules/echarts/lib/chart/boxplot/BoxplotSeries.js
generated
vendored
Normal file
108
frontend/node_modules/echarts/lib/chart/boxplot/BoxplotSeries.js
generated
vendored
Normal file
@ -0,0 +1,108 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
import { __extends } from "tslib";
|
||||
import SeriesModel from '../../model/Series.js';
|
||||
import { WhiskerBoxCommonMixin } from '../helper/whiskerBoxCommon.js';
|
||||
import { mixin } from 'zrender/lib/core/util.js';
|
||||
var BoxplotSeriesModel = /** @class */function (_super) {
|
||||
__extends(BoxplotSeriesModel, _super);
|
||||
function BoxplotSeriesModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.type = BoxplotSeriesModel.type;
|
||||
// TODO
|
||||
// box width represents group size, so dimension should have 'size'.
|
||||
/**
|
||||
* @see <https://en.wikipedia.org/wiki/Box_plot>
|
||||
* The meanings of 'min' and 'max' depend on user,
|
||||
* and echarts do not need to know it.
|
||||
* @readOnly
|
||||
*/
|
||||
_this.defaultValueDimensions = [{
|
||||
name: 'min',
|
||||
defaultTooltip: true
|
||||
}, {
|
||||
name: 'Q1',
|
||||
defaultTooltip: true
|
||||
}, {
|
||||
name: 'median',
|
||||
defaultTooltip: true
|
||||
}, {
|
||||
name: 'Q3',
|
||||
defaultTooltip: true
|
||||
}, {
|
||||
name: 'max',
|
||||
defaultTooltip: true
|
||||
}];
|
||||
_this.visualDrawType = 'stroke';
|
||||
return _this;
|
||||
}
|
||||
BoxplotSeriesModel.type = 'series.boxplot';
|
||||
BoxplotSeriesModel.dependencies = ['xAxis', 'yAxis', 'grid'];
|
||||
BoxplotSeriesModel.defaultOption = {
|
||||
// zlevel: 0,
|
||||
z: 2,
|
||||
coordinateSystem: 'cartesian2d',
|
||||
legendHoverLink: true,
|
||||
layout: null,
|
||||
boxWidth: [7, 50],
|
||||
itemStyle: {
|
||||
color: '#fff',
|
||||
borderWidth: 1
|
||||
},
|
||||
emphasis: {
|
||||
scale: true,
|
||||
itemStyle: {
|
||||
borderWidth: 2,
|
||||
shadowBlur: 5,
|
||||
shadowOffsetX: 1,
|
||||
shadowOffsetY: 1,
|
||||
shadowColor: 'rgba(0,0,0,0.2)'
|
||||
}
|
||||
},
|
||||
animationDuration: 800
|
||||
};
|
||||
return BoxplotSeriesModel;
|
||||
}(SeriesModel);
|
||||
mixin(BoxplotSeriesModel, WhiskerBoxCommonMixin, true);
|
||||
export default BoxplotSeriesModel;
|
172
frontend/node_modules/echarts/lib/chart/boxplot/BoxplotView.js
generated
vendored
Normal file
172
frontend/node_modules/echarts/lib/chart/boxplot/BoxplotView.js
generated
vendored
Normal file
@ -0,0 +1,172 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
import { __extends } from "tslib";
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import ChartView from '../../view/Chart.js';
|
||||
import * as graphic from '../../util/graphic.js';
|
||||
import { setStatesStylesFromModel, toggleHoverEmphasis } from '../../util/states.js';
|
||||
import Path from 'zrender/lib/graphic/Path.js';
|
||||
import { saveOldStyle } from '../../animation/basicTransition.js';
|
||||
var BoxplotView = /** @class */function (_super) {
|
||||
__extends(BoxplotView, _super);
|
||||
function BoxplotView() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.type = BoxplotView.type;
|
||||
return _this;
|
||||
}
|
||||
BoxplotView.prototype.render = function (seriesModel, ecModel, api) {
|
||||
var data = seriesModel.getData();
|
||||
var group = this.group;
|
||||
var oldData = this._data;
|
||||
// There is no old data only when first rendering or switching from
|
||||
// stream mode to normal mode, where previous elements should be removed.
|
||||
if (!this._data) {
|
||||
group.removeAll();
|
||||
}
|
||||
var constDim = seriesModel.get('layout') === 'horizontal' ? 1 : 0;
|
||||
data.diff(oldData).add(function (newIdx) {
|
||||
if (data.hasValue(newIdx)) {
|
||||
var itemLayout = data.getItemLayout(newIdx);
|
||||
var symbolEl = createNormalBox(itemLayout, data, newIdx, constDim, true);
|
||||
data.setItemGraphicEl(newIdx, symbolEl);
|
||||
group.add(symbolEl);
|
||||
}
|
||||
}).update(function (newIdx, oldIdx) {
|
||||
var symbolEl = oldData.getItemGraphicEl(oldIdx);
|
||||
// Empty data
|
||||
if (!data.hasValue(newIdx)) {
|
||||
group.remove(symbolEl);
|
||||
return;
|
||||
}
|
||||
var itemLayout = data.getItemLayout(newIdx);
|
||||
if (!symbolEl) {
|
||||
symbolEl = createNormalBox(itemLayout, data, newIdx, constDim);
|
||||
} else {
|
||||
saveOldStyle(symbolEl);
|
||||
updateNormalBoxData(itemLayout, symbolEl, data, newIdx);
|
||||
}
|
||||
group.add(symbolEl);
|
||||
data.setItemGraphicEl(newIdx, symbolEl);
|
||||
}).remove(function (oldIdx) {
|
||||
var el = oldData.getItemGraphicEl(oldIdx);
|
||||
el && group.remove(el);
|
||||
}).execute();
|
||||
this._data = data;
|
||||
};
|
||||
BoxplotView.prototype.remove = function (ecModel) {
|
||||
var group = this.group;
|
||||
var data = this._data;
|
||||
this._data = null;
|
||||
data && data.eachItemGraphicEl(function (el) {
|
||||
el && group.remove(el);
|
||||
});
|
||||
};
|
||||
BoxplotView.type = 'boxplot';
|
||||
return BoxplotView;
|
||||
}(ChartView);
|
||||
var BoxPathShape = /** @class */function () {
|
||||
function BoxPathShape() {}
|
||||
return BoxPathShape;
|
||||
}();
|
||||
var BoxPath = /** @class */function (_super) {
|
||||
__extends(BoxPath, _super);
|
||||
function BoxPath(opts) {
|
||||
var _this = _super.call(this, opts) || this;
|
||||
_this.type = 'boxplotBoxPath';
|
||||
return _this;
|
||||
}
|
||||
BoxPath.prototype.getDefaultShape = function () {
|
||||
return new BoxPathShape();
|
||||
};
|
||||
BoxPath.prototype.buildPath = function (ctx, shape) {
|
||||
var ends = shape.points;
|
||||
var i = 0;
|
||||
ctx.moveTo(ends[i][0], ends[i][1]);
|
||||
i++;
|
||||
for (; i < 4; i++) {
|
||||
ctx.lineTo(ends[i][0], ends[i][1]);
|
||||
}
|
||||
ctx.closePath();
|
||||
for (; i < ends.length; i++) {
|
||||
ctx.moveTo(ends[i][0], ends[i][1]);
|
||||
i++;
|
||||
ctx.lineTo(ends[i][0], ends[i][1]);
|
||||
}
|
||||
};
|
||||
return BoxPath;
|
||||
}(Path);
|
||||
function createNormalBox(itemLayout, data, dataIndex, constDim, isInit) {
|
||||
var ends = itemLayout.ends;
|
||||
var el = new BoxPath({
|
||||
shape: {
|
||||
points: isInit ? transInit(ends, constDim, itemLayout) : ends
|
||||
}
|
||||
});
|
||||
updateNormalBoxData(itemLayout, el, data, dataIndex, isInit);
|
||||
return el;
|
||||
}
|
||||
function updateNormalBoxData(itemLayout, el, data, dataIndex, isInit) {
|
||||
var seriesModel = data.hostModel;
|
||||
var updateMethod = graphic[isInit ? 'initProps' : 'updateProps'];
|
||||
updateMethod(el, {
|
||||
shape: {
|
||||
points: itemLayout.ends
|
||||
}
|
||||
}, seriesModel, dataIndex);
|
||||
el.useStyle(data.getItemVisual(dataIndex, 'style'));
|
||||
el.style.strokeNoScale = true;
|
||||
el.z2 = 100;
|
||||
var itemModel = data.getItemModel(dataIndex);
|
||||
var emphasisModel = itemModel.getModel('emphasis');
|
||||
setStatesStylesFromModel(el, itemModel);
|
||||
toggleHoverEmphasis(el, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
|
||||
}
|
||||
function transInit(points, dim, itemLayout) {
|
||||
return zrUtil.map(points, function (point) {
|
||||
point = point.slice();
|
||||
point[dim] = itemLayout.initBaseline;
|
||||
return point;
|
||||
});
|
||||
}
|
||||
export default BoxplotView;
|
181
frontend/node_modules/echarts/lib/chart/boxplot/boxplotLayout.js
generated
vendored
Normal file
181
frontend/node_modules/echarts/lib/chart/boxplot/boxplotLayout.js
generated
vendored
Normal file
@ -0,0 +1,181 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import { parsePercent } from '../../util/number.js';
|
||||
var each = zrUtil.each;
|
||||
export default function boxplotLayout(ecModel) {
|
||||
var groupResult = groupSeriesByAxis(ecModel);
|
||||
each(groupResult, function (groupItem) {
|
||||
var seriesModels = groupItem.seriesModels;
|
||||
if (!seriesModels.length) {
|
||||
return;
|
||||
}
|
||||
calculateBase(groupItem);
|
||||
each(seriesModels, function (seriesModel, idx) {
|
||||
layoutSingleSeries(seriesModel, groupItem.boxOffsetList[idx], groupItem.boxWidthList[idx]);
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Group series by axis.
|
||||
*/
|
||||
function groupSeriesByAxis(ecModel) {
|
||||
var result = [];
|
||||
var axisList = [];
|
||||
ecModel.eachSeriesByType('boxplot', function (seriesModel) {
|
||||
var baseAxis = seriesModel.getBaseAxis();
|
||||
var idx = zrUtil.indexOf(axisList, baseAxis);
|
||||
if (idx < 0) {
|
||||
idx = axisList.length;
|
||||
axisList[idx] = baseAxis;
|
||||
result[idx] = {
|
||||
axis: baseAxis,
|
||||
seriesModels: []
|
||||
};
|
||||
}
|
||||
result[idx].seriesModels.push(seriesModel);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Calculate offset and box width for each series.
|
||||
*/
|
||||
function calculateBase(groupItem) {
|
||||
var baseAxis = groupItem.axis;
|
||||
var seriesModels = groupItem.seriesModels;
|
||||
var seriesCount = seriesModels.length;
|
||||
var boxWidthList = groupItem.boxWidthList = [];
|
||||
var boxOffsetList = groupItem.boxOffsetList = [];
|
||||
var boundList = [];
|
||||
var bandWidth;
|
||||
if (baseAxis.type === 'category') {
|
||||
bandWidth = baseAxis.getBandWidth();
|
||||
} else {
|
||||
var maxDataCount_1 = 0;
|
||||
each(seriesModels, function (seriesModel) {
|
||||
maxDataCount_1 = Math.max(maxDataCount_1, seriesModel.getData().count());
|
||||
});
|
||||
var extent = baseAxis.getExtent();
|
||||
bandWidth = Math.abs(extent[1] - extent[0]) / maxDataCount_1;
|
||||
}
|
||||
each(seriesModels, function (seriesModel) {
|
||||
var boxWidthBound = seriesModel.get('boxWidth');
|
||||
if (!zrUtil.isArray(boxWidthBound)) {
|
||||
boxWidthBound = [boxWidthBound, boxWidthBound];
|
||||
}
|
||||
boundList.push([parsePercent(boxWidthBound[0], bandWidth) || 0, parsePercent(boxWidthBound[1], bandWidth) || 0]);
|
||||
});
|
||||
var availableWidth = bandWidth * 0.8 - 2;
|
||||
var boxGap = availableWidth / seriesCount * 0.3;
|
||||
var boxWidth = (availableWidth - boxGap * (seriesCount - 1)) / seriesCount;
|
||||
var base = boxWidth / 2 - availableWidth / 2;
|
||||
each(seriesModels, function (seriesModel, idx) {
|
||||
boxOffsetList.push(base);
|
||||
base += boxGap + boxWidth;
|
||||
boxWidthList.push(Math.min(Math.max(boxWidth, boundList[idx][0]), boundList[idx][1]));
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Calculate points location for each series.
|
||||
*/
|
||||
function layoutSingleSeries(seriesModel, offset, boxWidth) {
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
var data = seriesModel.getData();
|
||||
var halfWidth = boxWidth / 2;
|
||||
var cDimIdx = seriesModel.get('layout') === 'horizontal' ? 0 : 1;
|
||||
var vDimIdx = 1 - cDimIdx;
|
||||
var coordDims = ['x', 'y'];
|
||||
var cDim = data.mapDimension(coordDims[cDimIdx]);
|
||||
var vDims = data.mapDimensionsAll(coordDims[vDimIdx]);
|
||||
if (cDim == null || vDims.length < 5) {
|
||||
return;
|
||||
}
|
||||
for (var dataIndex = 0; dataIndex < data.count(); dataIndex++) {
|
||||
var axisDimVal = data.get(cDim, dataIndex);
|
||||
var median = getPoint(axisDimVal, vDims[2], dataIndex);
|
||||
var end1 = getPoint(axisDimVal, vDims[0], dataIndex);
|
||||
var end2 = getPoint(axisDimVal, vDims[1], dataIndex);
|
||||
var end4 = getPoint(axisDimVal, vDims[3], dataIndex);
|
||||
var end5 = getPoint(axisDimVal, vDims[4], dataIndex);
|
||||
var ends = [];
|
||||
addBodyEnd(ends, end2, false);
|
||||
addBodyEnd(ends, end4, true);
|
||||
ends.push(end1, end2, end5, end4);
|
||||
layEndLine(ends, end1);
|
||||
layEndLine(ends, end5);
|
||||
layEndLine(ends, median);
|
||||
data.setItemLayout(dataIndex, {
|
||||
initBaseline: median[vDimIdx],
|
||||
ends: ends
|
||||
});
|
||||
}
|
||||
function getPoint(axisDimVal, dim, dataIndex) {
|
||||
var val = data.get(dim, dataIndex);
|
||||
var p = [];
|
||||
p[cDimIdx] = axisDimVal;
|
||||
p[vDimIdx] = val;
|
||||
var point;
|
||||
if (isNaN(axisDimVal) || isNaN(val)) {
|
||||
point = [NaN, NaN];
|
||||
} else {
|
||||
point = coordSys.dataToPoint(p);
|
||||
point[cDimIdx] += offset;
|
||||
}
|
||||
return point;
|
||||
}
|
||||
function addBodyEnd(ends, point, start) {
|
||||
var point1 = point.slice();
|
||||
var point2 = point.slice();
|
||||
point1[cDimIdx] += halfWidth;
|
||||
point2[cDimIdx] -= halfWidth;
|
||||
start ? ends.push(point1, point2) : ends.push(point2, point1);
|
||||
}
|
||||
function layEndLine(ends, endCenter) {
|
||||
var from = endCenter.slice();
|
||||
var to = endCenter.slice();
|
||||
from[cDimIdx] -= halfWidth;
|
||||
to[cDimIdx] += halfWidth;
|
||||
ends.push(from, to);
|
||||
}
|
||||
}
|
66
frontend/node_modules/echarts/lib/chart/boxplot/boxplotTransform.js
generated
vendored
Normal file
66
frontend/node_modules/echarts/lib/chart/boxplot/boxplotTransform.js
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
import prepareBoxplotData from './prepareBoxplotData.js';
|
||||
import { throwError, makePrintable } from '../../util/log.js';
|
||||
import { SOURCE_FORMAT_ARRAY_ROWS } from '../../util/types.js';
|
||||
export var boxplotTransform = {
|
||||
type: 'echarts:boxplot',
|
||||
transform: function transform(params) {
|
||||
var upstream = params.upstream;
|
||||
if (upstream.sourceFormat !== SOURCE_FORMAT_ARRAY_ROWS) {
|
||||
var errMsg = '';
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
errMsg = makePrintable('source data is not applicable for this boxplot transform. Expect number[][].');
|
||||
}
|
||||
throwError(errMsg);
|
||||
}
|
||||
var result = prepareBoxplotData(upstream.getRawData(), params.config);
|
||||
return [{
|
||||
dimensions: ['ItemName', 'Low', 'Q1', 'Q2', 'Q3', 'High'],
|
||||
data: result.boxData
|
||||
}, {
|
||||
data: result.outliers
|
||||
}];
|
||||
}
|
||||
};
|
53
frontend/node_modules/echarts/lib/chart/boxplot/install.js
generated
vendored
Normal file
53
frontend/node_modules/echarts/lib/chart/boxplot/install.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
import BoxplotSeriesModel from './BoxplotSeries.js';
|
||||
import BoxplotView from './BoxplotView.js';
|
||||
import boxplotLayout from './boxplotLayout.js';
|
||||
import { boxplotTransform } from './boxplotTransform.js';
|
||||
export function install(registers) {
|
||||
registers.registerSeriesModel(BoxplotSeriesModel);
|
||||
registers.registerChartView(BoxplotView);
|
||||
registers.registerLayout(boxplotLayout);
|
||||
registers.registerTransform(boxplotTransform);
|
||||
}
|
96
frontend/node_modules/echarts/lib/chart/boxplot/prepareBoxplotData.js
generated
vendored
Normal file
96
frontend/node_modules/echarts/lib/chart/boxplot/prepareBoxplotData.js
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
import { quantile, asc } from '../../util/number.js';
|
||||
import { isFunction, isString } from 'zrender/lib/core/util.js';
|
||||
/**
|
||||
* 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 rawData like
|
||||
* [
|
||||
* [12,232,443], (raw data set for the first box)
|
||||
* [3843,5545,1232], (raw data set for the second box)
|
||||
* ...
|
||||
* ]
|
||||
* @param 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.
|
||||
*/
|
||||
export default function prepareBoxplotData(rawData, opt) {
|
||||
opt = opt || {};
|
||||
var boxData = [];
|
||||
var outliers = [];
|
||||
var boundIQR = opt.boundIQR;
|
||||
var useExtreme = boundIQR === 'none' || boundIQR === 0;
|
||||
for (var i = 0; i < rawData.length; 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);
|
||||
var itemNameFormatter = opt.itemNameFormatter;
|
||||
var itemName = isFunction(itemNameFormatter) ? itemNameFormatter({
|
||||
value: i
|
||||
}) : isString(itemNameFormatter) ? itemNameFormatter.replace('{value}', i + '') : i + '';
|
||||
boxData.push([itemName, low, Q1, Q2, Q3, high]);
|
||||
for (var j = 0; j < ascList.length; j++) {
|
||||
var dataItem = ascList[j];
|
||||
if (dataItem < low || dataItem > high) {
|
||||
var outlier = [itemName, dataItem];
|
||||
outliers.push(outlier);
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
boxData: boxData,
|
||||
outliers: outliers
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user