fix: #299 Cycle efficiency X axis should only display to YYYYMM.
This commit is contained in:
@@ -154,6 +154,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import moment from 'moment';
|
||||
import LoadingStore from '@/stores/loading.js';
|
||||
import CompareStore from '@/stores/compare.js';
|
||||
import SidebarStates from '@/components/Compare/SidebarStates.vue';
|
||||
@@ -438,7 +439,6 @@ export default {
|
||||
const maxX = chartData.x_axis.max;
|
||||
const minX = chartData.x_axis.min;
|
||||
const getMoment = (time)=> this.$moment(time).format('YYYY/MM/DD');
|
||||
const getDateLabel = getDateLabelByMinMaxDate;
|
||||
let datasetsPrimary = chartData.data[0].data;
|
||||
let xDataPrimary;
|
||||
let yDataPrimary;
|
||||
@@ -522,6 +522,17 @@ export default {
|
||||
scales: this.customizeScaleChartOptionTitleByContent(knownScaleBarChartOptions, content),
|
||||
};
|
||||
|
||||
primeVueSetOption.scales = {
|
||||
...primeVueSetOption.scales,
|
||||
x: {
|
||||
ticks: {
|
||||
callback: function(value, index, ticks) {
|
||||
return moment(xDataPrimary[index]).format('YYYY/MM');
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
if(caller === "Cycle Eff") { //針對 cycle efficiency 特別處理
|
||||
primeVueSetOption.scales.y.reverse = true; //不明原因上下顛倒,所以要顛倒過來
|
||||
primeVueSetOption.scales.y.ticks.callback = function (value, index, ticks) {
|
||||
|
||||
@@ -141,6 +141,7 @@
|
||||
<script>
|
||||
import { storeToRefs, mapActions, } from 'pinia';
|
||||
import axios from 'axios';
|
||||
import moment from 'moment';
|
||||
import LoadingStore from '@/stores/loading.js';
|
||||
import PerformanceStore from '@/stores/performance.js';
|
||||
import ConformanceStore from '@/stores/conformance.js';
|
||||
@@ -505,9 +506,8 @@ export default {
|
||||
ticks: {
|
||||
display: true,
|
||||
color: '#64748b',
|
||||
callback: function(v, i, t) {
|
||||
let label = xData[i]
|
||||
return getDateLabelByMinMaxDate(label, maxX, minX)
|
||||
callback: function(value, index, ticks) {
|
||||
return moment(xData[index]).format('YYYY/MM');
|
||||
},
|
||||
},
|
||||
border: {
|
||||
|
||||
Reference in New Issue
Block a user