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