|
@@ -2539,7 +2539,7 @@ const SpreadJsObj = {
|
|
|
getStackedBarCellType: function () {
|
|
|
const stackedBarCellType = function(){};
|
|
|
stackedBarCellType.prototype = new spreadNS.CellTypes.Text();
|
|
|
- const indent = 3, defaultR = 3, minHeight = 2;
|
|
|
+ const indent = 3, defaultR = 0.05, minHeight = 2;
|
|
|
/**
|
|
|
* 画一个长条
|
|
|
* @param {Object} canvas - 画布
|
|
@@ -2547,6 +2547,23 @@ const SpreadJsObj = {
|
|
|
* @param {String} lineColor - 画线颜色
|
|
|
* @param {String} fillColor - 填充颜色
|
|
|
*/
|
|
|
+ // roundRect方法在Chrome99版本以后才支持
|
|
|
+ const drawBarbefore99 = function (canvas, x, y, w, h, r, color) {
|
|
|
+ canvas.save();
|
|
|
+ // 设置偏移量
|
|
|
+ canvas.translate(0.5, 0.5);
|
|
|
+ canvas.strokeStyle = color;
|
|
|
+ canvas.beginPath();
|
|
|
+ canvas.moveTo(x+r, y);
|
|
|
+ canvas.arcTo(x+w, y, x+w, y+h, r);
|
|
|
+ canvas.arcTo(x+w, y+h, x, y+h, r);
|
|
|
+ canvas.arcTo(x, y+h, x, y, r);
|
|
|
+ canvas.arcTo(x, y, x+w, y, r);
|
|
|
+ canvas.stroke();
|
|
|
+ canvas.fillStyle = color;
|
|
|
+ canvas.fill();
|
|
|
+ canvas.restore();
|
|
|
+ };
|
|
|
const drawBar = function (canvas, x, y, w, h, r, color) {
|
|
|
canvas.save();
|
|
|
// 设置偏移量
|
|
@@ -2589,7 +2606,7 @@ const SpreadJsObj = {
|
|
|
let width = ZhCalc.mul(validWidth, bd.percent, 2);
|
|
|
if (width < defaultR) continue;
|
|
|
const top = col.stackedBarCover ? startTop : startTop + height * i + i - 1;
|
|
|
- drawBar(canvas, left, top, width, height, defaultR, bd.color);
|
|
|
+ drawBarbefore99(canvas, left, top, width, height, ZhCalc.mul(height, defaultR, 2), bd.color);
|
|
|
}
|
|
|
};
|
|
|
return new stackedBarCellType();
|