提交 26f5b31f 编写于 作者: K kener

数值型坐标轴支持显示项目名字

上级 9e351ec6
......@@ -147,6 +147,8 @@
// 类目轴
categoryAxis: {
position: 'bottom', // 位置
name: '', // 坐标轴名字,默认为空
nameLocation: 'end', // 坐标轴名字位置,支持'start' | 'end'
boundaryGap: true, // 类目起始和结束两端空白策略
axisLine: { // 坐标轴线
show: true, // 默认显示,属性show控制显示与否
......@@ -193,6 +195,8 @@
// 数值型坐标轴默认参数
valueAxis: {
position: 'left', // 位置
name: '', // 坐标轴名字,默认为空
nameLocation: 'end', // 坐标轴名字位置,支持'start' | 'end'
boundaryGap: [0, 0], // 数值起始和结束两端空白策略
// min: null, // 最小值
// max: null, // 最大值
......@@ -260,7 +264,11 @@
// color: 各异,
lineStyle: {
width: 1,
style: 'solid'
style: 'solid',
shadowColor : 'rgba(0,0,0,0)', //默认透明
shadowBlur: 5,
shadowOffsetX: 3,
shadowOffsetY: 3
}
},
emphasis: {
......
......@@ -1035,6 +1035,18 @@ feature : {
<td> 通用 </td>
<td> 坐标轴类型,横轴默认为类目型'bottom',纵轴默认为数值型'left',可选为:'bottom' | 'top' | 'left' | 'right' </td>
</tr>
<tr>
<td> {string} name </td>
<td> '' </td>
<td> 数值型 </td>
<td> 坐标轴名称,默认为空</td>
</tr>
<tr>
<td> {string} nameLocation </td>
<td> 'end' </td>
<td> 数值型 </td>
<td> 坐标轴名称位置,默认为'end',可选为:'start' | 'end'</td>
</tr>
<tr>
<td> {boolean} boundaryGap </td>
<td> true </td>
......
......@@ -93,6 +93,7 @@ option = {
yAxis : [
{
type : 'value',
name : '水量',
axisLabel : {
formatter: '{value} ml'
},
......@@ -100,6 +101,7 @@ option = {
},
{
type : 'value',
name : '温度',
axisLabel : {
formatter: '{value} °C'
},
......
......@@ -64,17 +64,17 @@ define(function (require) {
case 'left' :
axShape.style = {
xStart : grid.getX(),
yStart : grid.getY(),
yStart : grid.getYend(),
xEnd : grid.getX(),
yEnd : grid.getYend()
yEnd : grid.getY()
};
break;
case 'right' :
axShape.style = {
xStart : grid.getXend(),
yStart : grid.getY(),
yStart : grid.getYend(),
xEnd : grid.getXend(),
yEnd : grid.getYend()
yEnd : grid.getY()
};
break;
case 'bottom' :
......@@ -94,7 +94,10 @@ define(function (require) {
};
break;
}
if (option.name !== '') {
axShape.style.text = option.name;
axShape.style.textPosition = option.nameLocation;
}
axShape.style.strokeColor = option.axisLine.lineStyle.color;
axShape.style.lineWidth = option.axisLine.lineStyle.width;
axShape.style.lineType = option.axisLine.lineStyle.type;
......@@ -190,7 +193,11 @@ define(function (require) {
color : textStyle.color,
text : _valueLabel[i],
textFont : self.getFont(textStyle),
textAlign : 'center',
textAlign : i === 0
? 'left'
: i == (dataLength - 1)
? 'right'
: 'center',
textBaseline : baseLine
}
};
......@@ -234,9 +241,14 @@ define(function (require) {
text : _valueLabel[i],
textFont : self.getFont(textStyle),
textAlign : align,
textBaseline : 'middle'
textBaseline : i === 0
? 'bottom'
: (i == dataLength - 1)
? 'top'
: 'middle'
}
};
if (rotate) {
axShape.rotation = [
rotate * Math.PI / 180,
......
......@@ -178,6 +178,8 @@ define(function() {
// 类目轴
categoryAxis: {
position: 'bottom', // 位置
name: '', // 坐标轴名字,默认为空
nameLocation: 'end', // 坐标轴名字位置,支持'start' | 'end'
boundaryGap: true, // 类目起始和结束两端空白策略
axisLine: { // 坐标轴线
show: true, // 默认显示,属性show控制显示与否
......@@ -225,6 +227,8 @@ define(function() {
// 数值型坐标轴默认参数
valueAxis: {
position: 'left', // 位置
name: '', // 坐标轴名字,默认为空
nameLocation: 'end', // 坐标轴名字位置,支持'start' | 'end'
boundaryGap: [0, 0], // 数值起始和结束两端空白策略
// min: null, // 最小值
// max: null, // 最大值
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册