关于分时显示成交量红绿柱的问题,我们总结了以下几点,给你解答:
分时成交量红绿柱怎么调
,恩,明白。
那是设置的问题。
摁CTRL+D→设置4→右面第三个选项打钩
然后想看以前某一日的分时图,点那一日的一下,回车。就这样。
gzclick广州点击网为你解答
分时显示成交量红绿柱
if (data.length > 0) {
let volumeArr = [];
let volumeColorArr = [];
for (let i = 0; i < data.length; i++) {
volumeArr.push(data[i].volume);
if (data[i].close > data[i].open) {
volumeColorArr.push('#ef232a');
} else {
volumeColorArr.push('#14b143');
}
}
this.setData({
volumeArr: volumeArr,
volumeColorArr: volumeColorArr
});
}
},
//计算最大值
countMax: function (data) {
let maxPrice = 0;
let minPrice = data[0].low;
let maxVolume = 0;
for (let i = 0; i < data.length; i++) {
if (data[i].high > maxPrice) {
maxPrice = data[i].high;
}
if (data[i].low < minPrice) {
minPrice = data[i].low;
}
if (data[i].volume > maxVolume) {
maxVolume = data[i].volume;
}
}
this.setData({
maxPrice: maxPrice,
minPrice: minPrice,
maxVolume: maxVolume
});
},
//计算比例
countRatio: function (data) {
let maxPrice = this.data.maxPrice;
let minPrice = this.data.minPrice;
let maxVolume = this.data.maxVolume;
let cHeight = this.data.cHeight;
let cWidth = this.data.cWidth;
let ratioPrice = cHeight / (maxPrice - minPrice);
let ratioVolume = cWidth / maxVolume;
this.setData({
ratioPrice: ratioPrice,
ratioVolume: ratioVolume
});
},
//计算坐标
countCoordinate: function (data) {
let cHeight = this.data.cHeight;
let cWidth = this.data.cWidth;
let ratioPrice = this.data.ratioPrice;
let ratioVolume = this.data.ratioVolume;
let maxPrice = this.data.maxPrice;
let minPrice = this.data.minPrice;
let coordinateArr = [];
for (let i = 0; i < data.length; i++) {
let coordinate = {};
coordinate.x = i * cWidth / data.length + cWidth / data.length / 2;
coordinate.y = cHeight - (data[i].close - minPrice) * ratioPrice + this.data.canvasTop;
coordinate.lowY = cHeight - (data[i].low - minPrice) * ratioPrice + this.data.canvasTop;
coordinate.highY = cHeight - (data[i].high - minPrice) * ratioPrice + this.data.canvasTop;
coordinate.openY = cHeight - (data[i].open - minPrice) * ratioPrice + this.data.canvasTop;
coordinate.volumeX = i * cWidth / data.length + cWidth / data.length / 2;
coordinate.volumeY = cHeight - (data[i].volume - 0) * ratioVolume + this.data.canvasTop;
coordinateArr.push(coordinate);
}
this.setData({
coordinateArr: coordinateArr
});
},
//绘制K线
drawK: function (data) {
let coordinateArr = this.data.coordinateArr;
let ctx = this.data.ctx;
ctx.beginPath();
ctx.setLineWidth(1);
ctx.setStrokeStyle('#000000');
for (let i = 0; i < data.length; i++) {
if (data[i].close > data[i].open) {
ctx.setFillStyle('#ef232a');
} else {
ctx.setFillStyle('#14b143');
}
ctx.moveTo(coordinateArr[i].x, coordinateArr[i].highY);
ctx.lineTo(coordinateArr[i].x, coordinateArr[i].lowY);
ctx.fillRect(coordinateArr[i].x - 2, coordinateArr[i].openY, 4, coordinateArr[i].y - coordinateArr[i].openY);
}
ctx.stroke();
ctx.draw();
},
//绘制成交量
drawV: function (data) {
let coordinateArr = this.data.coordinateArr;
let ctx = this.data.ctx;
ctx.beginPath();
ctx.setLineWidth(1);
ctx.setStrokeStyle('#000000');
for (let i = 0; i < data.length; i++) {
ctx.setFillStyle(this.data.volumeColorArr[i]);
ctx.fillRect(coordinateArr[i].volumeX - 2, coordinateArr[i].volumeY, 4, ctx.measureText(data[i].volume).width);
}
ctx.stroke();
ctx.draw();
},
//绘制坐标轴
drawC: function (data) {
let ctx = this.data.ctx;
let cHeight = this.data.cHeight;
let cWidth = this.data.cWidth;
let canvasTop = this.data.canvasTop;
let canvasBottom = this.data.canvasBottom;
let maxPrice = this.data.maxPrice;
let minPrice = this.data.minPrice;
let maxVolume = this.data.maxVolume;
ctx.beginPath();
ctx.setLineWidth(1);
ctx.setStrokeStyle('#000000');
ctx.moveTo(0, canvasTop);
ctx.lineTo(0, canvasTop + cHeight);
ctx.lineTo(cWidth, canvasTop + cHeight);
ctx.stroke();
ctx.draw();
//绘制价格刻度
ctx.beginPath();
ctx.setFontSize(10);
ctx.setFillStyle('#000000');
ctx.fillText(maxPrice.toFixed(2), 0, canvasTop + 10);
ctx.fillText(((maxPrice - minPrice) / 2 + minPrice).toFixed(2), 0, canvasTop + cHeight / 2);
ctx.fillText(minPrice.toFixed(2), 0, canvasTop + cHeight - 10);
ctx.fill();
ctx.draw();
//绘制成交量刻度
ctx.beginPath();
ctx.setFontSize(10);
ctx.setFillStyle('#000000');
ctx.fillText(maxVolume, 0, canvasBottom - 10);
ctx.fillText(maxVolume / 2, 0, canvasBottom - cHeight / 2);
ctx.fillText(0, 0, canvasBottom);
ctx.fill();
ctx.draw();
},
//绘制边框
drawB: function (data) {
let ctx = this.data.ctx;
let cHeight = this.data.cHeight;
let cWidth = this.data.cWidth;
let canvasTop = this.data.canvasTop;
let canvasBottom = this.data.canvasBottom;
ctx.beginPath();
ctx.setLineWidth(1);
ctx.setStrokeStyle('#000000');
ctx.rect(0, canvasTop, cWidth, cHeight);
ctx.rect(0, canvasBottom, cWidth, cHeight);
ctx.stroke();
ctx.draw();
},
//绘制K线图
drawChart: function (data) {
this.countMax(data);
this.countRatio(data);
分时成交量红绿柱什么意思
分时图中的成交量红绿柱过了一分钟就自动锁定,不会再变化。
成交量柱状图红色代表虽难草当要雷山角传修当日的收盘价高于济倍半倒念妒红级开盘价,绿色代表当日的收露盘价低于开盘价,白色代表当日的收盘价与开盘价一样。