提交 3733d096 编写于 作者: K kener

component style can be configured

上级 b7654f1a
...@@ -233,6 +233,7 @@ define(function (require) { ...@@ -233,6 +233,7 @@ define(function (require) {
var itemWidth = this.dataRangeOption.itemWidth; var itemWidth = this.dataRangeOption.itemWidth;
var itemHeight = this.dataRangeOption.itemHeight; var itemHeight = this.dataRangeOption.itemHeight;
var textHeight = zrArea.getTextHeight('', font); var textHeight = zrArea.getTextHeight('', font);
var mSize = 10;
var needValueText = true; var needValueText = true;
...@@ -272,16 +273,16 @@ define(function (require) { ...@@ -272,16 +273,16 @@ define(function (require) {
style : { style : {
x : lastX, x : lastX,
y : lastY, y : lastY,
width : itemWidth * 10, width : itemWidth * mSize,
height : itemHeight, height : itemHeight,
color : zrColor.getLinearGradient( color : zrColor.getLinearGradient(
lastX, lastY, lastX + itemWidth * 10, lastY, lastX, lastY, lastX + itemWidth * mSize, lastY,
colorList colorList
) )
}, },
hoverable : false hoverable : false
}; };
lastX += itemWidth * 10 + this._textGap; lastX += itemWidth * mSize + this._textGap;
} }
else { else {
itemShape = { itemShape = {
...@@ -291,15 +292,15 @@ define(function (require) { ...@@ -291,15 +292,15 @@ define(function (require) {
x : lastX, x : lastX,
y : lastY, y : lastY,
width : itemWidth, width : itemWidth,
height : itemHeight * 10, height : itemHeight * mSize,
color : zrColor.getLinearGradient( color : zrColor.getLinearGradient(
lastX, lastY, lastX, lastY + itemHeight * 10, lastX, lastY, lastX, lastY + itemHeight * mSize,
colorList colorList
) )
}, },
hoverable : false hoverable : false
}; };
lastY += itemHeight * 10 + this._textGap; lastY += itemHeight * mSize + this._textGap;
} }
this.shapeList.push(new RectangleShape(itemShape)); this.shapeList.push(new RectangleShape(itemShape));
// 可计算元素的位置缓存 // 可计算元素的位置缓存
...@@ -600,6 +601,7 @@ define(function (require) { ...@@ -600,6 +601,7 @@ define(function (require) {
text : this._textFormat(this.dataRangeOption.max), text : this._textFormat(this.dataRangeOption.max),
textX : textXStart, textX : textXStart,
textY : textYStart, textY : textYStart,
textFont: font,
color : this.getColor(this.dataRangeOption.max), color : this.getColor(this.dataRangeOption.max),
rect : coverRectStart, rect : coverRectStart,
x : pointListStart[0][0], x : pointListStart[0][0],
...@@ -619,6 +621,7 @@ define(function (require) { ...@@ -619,6 +621,7 @@ define(function (require) {
text : this._textFormat(this.dataRangeOption.min), text : this._textFormat(this.dataRangeOption.min),
textX : textXEnd, textX : textXEnd,
textY : textYEnd, textY : textYEnd,
textFont: font,
color : this.getColor(this.dataRangeOption.min), color : this.getColor(this.dataRangeOption.min),
rect : coverRectEnd, rect : coverRectEnd,
x : pointListEnd[0][0], x : pointListEnd[0][0],
...@@ -730,6 +733,7 @@ define(function (require) { ...@@ -730,6 +733,7 @@ define(function (require) {
var totalHeight = 0; var totalHeight = 0;
var font = this.getFont(this.dataRangeOption.textStyle); var font = this.getFont(this.dataRangeOption.textStyle);
var textHeight = zrArea.getTextHeight('', font); var textHeight = zrArea.getTextHeight('', font);
var mSize = 10;
if (this.dataRangeOption.orient == 'horizontal') { if (this.dataRangeOption.orient == 'horizontal') {
// 水平布局,计算总宽度 // 水平布局,计算总宽度
...@@ -741,7 +745,7 @@ define(function (require) { ...@@ -741,7 +745,7 @@ define(function (require) {
totalWidth = totalWidth =
((this.dataRangeOption.splitNumber <= 0 ((this.dataRangeOption.splitNumber <= 0
|| this.dataRangeOption.calculable) || this.dataRangeOption.calculable)
? (itemWidth * 10 + itemGap) ? (itemWidth * mSize + itemGap)
: dataLength * (itemWidth + itemGap)) : dataLength * (itemWidth + itemGap))
+ (this.dataRangeOption.text + (this.dataRangeOption.text
&& typeof this.dataRangeOption.text[0] != 'undefined' && typeof this.dataRangeOption.text[0] != 'undefined'
...@@ -784,7 +788,7 @@ define(function (require) { ...@@ -784,7 +788,7 @@ define(function (require) {
totalHeight = totalHeight =
((this.dataRangeOption.splitNumber <= 0 ((this.dataRangeOption.splitNumber <= 0
|| this.dataRangeOption.calculable) || this.dataRangeOption.calculable)
? (itemHeight * 10 + itemGap) ? (itemHeight * mSize + itemGap)
: dataLength * (itemHeight + itemGap)) : dataLength * (itemHeight + itemGap))
+ (this.dataRangeOption.text + (this.dataRangeOption.text
&& typeof this.dataRangeOption.text[0] != 'undefined' && typeof this.dataRangeOption.text[0] != 'undefined'
......
...@@ -36,7 +36,6 @@ define(function (require) { ...@@ -36,7 +36,6 @@ define(function (require) {
}; };
this._fillerSize = 28; // 控件大小,水平布局为高,纵向布局为宽 this._fillerSize = 28; // 控件大小,水平布局为高,纵向布局为宽
this._handleSize = 8; // 手柄大小
// this._fillerShae; // 填充 // this._fillerShae; // 填充
// this._startShape; // 起始手柄 // this._startShape; // 起始手柄
// this._endShape; // 结束手柄 // this._endShape; // 结束手柄
...@@ -49,6 +48,7 @@ define(function (require) { ...@@ -49,6 +48,7 @@ define(function (require) {
this.option.dataZoom = this.reformOption(this.option.dataZoom); this.option.dataZoom = this.reformOption(this.option.dataZoom);
this.zoomOption = this.option.dataZoom; this.zoomOption = this.option.dataZoom;
this._handleSize = this.zoomOption.handleSize;
if (!this.myChart.canvasSupported) { if (!this.myChart.canvasSupported) {
// 不支持Canvas的强制关闭实时动画 // 不支持Canvas的强制关闭实时动画
this.zoomOption.realtime = false; this.zoomOption.realtime = false;
......
...@@ -404,8 +404,8 @@ define(function (require) { ...@@ -404,8 +404,8 @@ define(function (require) {
if (timelineOption.controlPosition === 'none') { if (timelineOption.controlPosition === 'none') {
return; return;
} }
var iconSize = 15; var iconSize = controlStyle.itemSize;
var iconGap = 5; var iconGap = controlStyle.itemGap;
var x; var x;
if (timelineOption.controlPosition === 'left') { if (timelineOption.controlPosition === 'left') {
x = this._location.x; x = this._location.x;
......
...@@ -302,6 +302,7 @@ define(function() { ...@@ -302,6 +302,7 @@ define(function() {
dataBackgroundColor: '#eee', // 数据背景颜色 dataBackgroundColor: '#eee', // 数据背景颜色
fillerColor: 'rgba(144,197,237,0.2)', // 填充颜色 fillerColor: 'rgba(144,197,237,0.2)', // 填充颜色
handleColor: 'rgba(70,130,180,0.8)', // 手柄颜色 handleColor: 'rgba(70,130,180,0.8)', // 手柄颜色
handleSize: 8,
showDetail: true, showDetail: true,
// xAxisIndex: [], // 默认控制所有横向类目 // xAxisIndex: [], // 默认控制所有横向类目
// yAxisIndex: [], // 默认控制所有横向类目 // yAxisIndex: [], // 默认控制所有横向类目
...@@ -539,6 +540,8 @@ define(function() { ...@@ -539,6 +540,8 @@ define(function() {
} }
}, },
controlStyle: { controlStyle: {
itemSize: 15,
itemGap: 5,
normal: { color: '#333'}, normal: { color: '#333'},
emphasis: { color: '#1e90ff'} emphasis: { color: '#1e90ff'}
}, },
...@@ -1294,6 +1297,7 @@ define(function() { ...@@ -1294,6 +1297,7 @@ define(function() {
//symbolRotate: null, //symbolRotate: null,
//smooth: false, //smooth: false,
large: false, large: false,
precision: 2,
effect: { effect: {
show: false, show: false,
loop: true, loop: true,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册