我使用highcharts创建了堆叠柱形图,用于处理我使用自定义对数函数的大量数据变量。工作正常但是图表高度存在问题并不明显。
function calcLog(val) {
return (val > 0) ? Math.log(val * Math.E) : null;
}
function calcAntiLog(val) {
return (val > 0) ? Math.round(Math.exp(val) / Math.E) : null;
}
function calcTotalAntiLog(valMatrix, idx) {
if (valMatrix) {
sum = 0;
for (i = 0; i < valMatrix.length; i++) {
sum += calcAntiLog(valMatrix[i][idx]);
}
return sum;
}
return "";
}
function calcTotalAntiLog2(hcObj) {
if (hcObj) {
var idx = hcObj.x;
sum = 0;
for (i = 0; i < hcObj.axis.chart.series.length; i++) {
sum += calcAntiLog(hcObj.axis.chart.series[i].yData[idx]);
}
return sum;
}
return null;
}
function das(hcObj) {
if (hcObj) {
var idx = hcObj.x;
sum = 0;
zeroVisits = 0;
for (i = 0; i < hcObj.axis.chart.series.length; i++) {
sum += calcAntiLog(hcObj.axis.chart.series[i].yData[idx]);
if (i == 0) zeroVisits = sum;
}
return (100 * (sum - zeroVisits)) / sum;
}
return null;
}