refine use ticks[ticks.length - 1].value
This commit is contained in:
@@ -411,7 +411,7 @@ export default {
|
||||
primeVueSetOption.scales.y.ticks.callback = function (value, index, ticks) {
|
||||
// resultStepSize: Y 軸一個刻度的高度的純數值部分,unitToUse則可能是 d,h,m,s 四者之一
|
||||
// ticks.length是動態由 PrimeVue 決定的,例如可能是 6 或是 8
|
||||
const {resultStepSize, unitToUse} = getStepSizeOfYTicks(maxY, ticks.length);
|
||||
const {resultStepSize, unitToUse} = getStepSizeOfYTicks(ticks[ticks.length - 1].value, ticks.length);
|
||||
return getYTicksByIndex(resultStepSize, index, unitToUse);
|
||||
};
|
||||
primeVueSetOption.scales.y.ticks.stepSize = resultStepSize;
|
||||
@@ -882,7 +882,7 @@ export default {
|
||||
padding: 8,
|
||||
callback: function (value, index, ticks) {
|
||||
// resultStepSize: Y 軸一個刻度的高度的純數值部分,unitToUse則可能是 d,h,m,s 四者之一
|
||||
const {resultStepSize, unitToUse} = getStepSizeOfYTicks(maxY, ticks.length);
|
||||
const {resultStepSize, unitToUse} = getStepSizeOfYTicks(ticks[ticks.length - 1].value, ticks.length);
|
||||
return getYTicksByIndex(resultStepSize, index, unitToUse);
|
||||
},
|
||||
}
|
||||
@@ -1026,7 +1026,7 @@ export default {
|
||||
padding: 8,
|
||||
callback: function (value, index, ticks) {
|
||||
// resultStepSize: Y 軸一個刻度的高度的純數值部分,unitToUse則可能是 d,h,m,s 四者之一
|
||||
const {resultStepSize, unitToUse} = getStepSizeOfYTicks(maxY, ticks.length);
|
||||
const {resultStepSize, unitToUse} = getStepSizeOfYTicks(ticks[ticks.length - 1].value, ticks.length);
|
||||
return getYTicksByIndex(resultStepSize, index, unitToUse);
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user