|
@@ -46,9 +46,21 @@
|
|
|
if (options) this.initChart().setOption(options, true);
|
|
|
};
|
|
|
|
|
|
+ function getStrLen(str) {
|
|
|
+ var len = 0;
|
|
|
+ for (var i = 0; i < str.length; i++) {
|
|
|
+ if (str.charCodeAt(i) > 127 || str.charCodeAt(i) == 94) {
|
|
|
+ len += 2;
|
|
|
+ } else {
|
|
|
+ len++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return len;
|
|
|
+ }
|
|
|
+
|
|
|
function getBarPointTopicOptions(datas) {
|
|
|
var yAxisLabels = datas.map(function (item) {
|
|
|
- return item.name;
|
|
|
+ return [item.name, item.number].join('#');
|
|
|
});
|
|
|
var avgDatas = datas.map(function (item) {
|
|
|
return item.avgScore;
|
|
@@ -225,8 +237,13 @@
|
|
|
}
|
|
|
},
|
|
|
axisLabel: {
|
|
|
- fontSize: 19,
|
|
|
- margin: 30
|
|
|
+ fontSize: 17,
|
|
|
+ margin: 20,
|
|
|
+ formatter: function (value) {
|
|
|
+ var str = value.split('#');
|
|
|
+ if (str[0].length > 10) str[0] = str[0].substr(0, 10) + '...'
|
|
|
+ return [str[0], str[1]].join(' ')
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
{
|
|
@@ -819,6 +836,7 @@
|
|
|
textStyle: textStyle,
|
|
|
grid: {
|
|
|
top: 120,
|
|
|
+ bottom: 100,
|
|
|
show: true,
|
|
|
borderColor: "rgba(230,230,230,1)"
|
|
|
},
|
|
@@ -835,7 +853,11 @@
|
|
|
axisLabel: {
|
|
|
fontSize: 19,
|
|
|
margin: 20,
|
|
|
- interval: 0
|
|
|
+ interval: 0,
|
|
|
+ formatter: function name(value) {
|
|
|
+ var str = sectionArr(value, 9)
|
|
|
+ return str.join('\n')
|
|
|
+ }
|
|
|
},
|
|
|
axisLine: {
|
|
|
lineStyle: {
|
|
@@ -889,7 +911,7 @@
|
|
|
|
|
|
function getLineReverseOptions(datas) {
|
|
|
var yAxisDatas = datas.map(function (item) {
|
|
|
- return item.name;
|
|
|
+ return [item.name, item.number].join('#');
|
|
|
});
|
|
|
var levelDatas = datas.map(function (item) {
|
|
|
return item.difficulty;
|
|
@@ -910,7 +932,7 @@
|
|
|
textStyle: textStyle,
|
|
|
grid: {
|
|
|
top: 150,
|
|
|
- left: 170,
|
|
|
+ left: 200,
|
|
|
bottom: 50,
|
|
|
show: true,
|
|
|
borderColor: "rgba(230,230,230,1)"
|
|
@@ -929,7 +951,12 @@
|
|
|
axisLabel: {
|
|
|
fontSize: 17,
|
|
|
margin: 20,
|
|
|
- interval: 0
|
|
|
+ interval: 0,
|
|
|
+ formatter: function (value) {
|
|
|
+ var str = value.split('#');
|
|
|
+ if (str[0].length > 10) str[0] = str[0].substr(0, 10) + '...';
|
|
|
+ return [str[0], str[1]].join(' ')
|
|
|
+ }
|
|
|
},
|
|
|
axisLine: {
|
|
|
lineStyle: {
|
|
@@ -1064,5 +1091,13 @@
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+ function sectionArr(arrayList, sectionLength) {
|
|
|
+ var splitArr = [];
|
|
|
+ for (var i = 0, len = arrayList.length; i < len; i += sectionLength) {
|
|
|
+ splitArr.push(arrayList.slice(i, i + sectionLength));
|
|
|
+ }
|
|
|
+ return splitArr;
|
|
|
+ }
|
|
|
+
|
|
|
window.Charts = Charts;
|
|
|
})(window);
|