523
523
524
524
<!-- BAR | LINE CHARTS -->
525
525
<template v-if =" [constants .BAR , constants .LINE ].includes (chart .type ) && ! showDonutOptions " >
526
+ <label v-if =" chartTimeLabelOptions.length > 1" >
527
+ {{ FINAL_CONFIG.translations.xAxisLabels }}
528
+ <select v-model =" chartTimeLabelSourceModel" >
529
+ <option v-for =" opt in chartTimeLabelOptions" >{{ opt }}</option >
530
+ </select >
531
+ </label >
526
532
<div style =" width : 100% ; margin-bottom : 12px " >
527
- <VueUiXy :dataset =" chartData.xyDatasetLine" :config =" chartData.xyConfig" v-if =" chart.type === constants.LINE" />
528
- <VueUiXy :dataset =" chartData.xyDatasetBar" :config =" chartData.xyConfig" v-if =" chart.type === constants.BAR" />
533
+ <VueUiXy :key = " `chart_line_${chartStep}` " : dataset =" chartData.xyDatasetLine" :config =" chartData.xyConfig" v-if =" chart.type === constants.LINE" />
534
+ <VueUiXy :key = " `chart_bar_${chartStep}` " : dataset =" chartData.xyDatasetBar" :config =" chartData.xyConfig" v-if =" chart.type === constants.BAR" />
529
535
</div >
530
536
<div v-if =" currentSelectionSpan.rows.length >= 2" class =" chart-trend"
531
537
:style =" `color:${FINAL_CONFIG.style.chart.modal.color}`" >
532
538
<span >---</span > Trend: {{ dataLabel({
533
- v: chartData.progression.trend,
539
+ v: chartData.progression.trend * 100 ,
534
540
s: '%',
535
541
r: 1
536
542
}) }}
@@ -656,13 +662,15 @@ export default {
656
662
showChart: false ,
657
663
showDonutOptions: false ,
658
664
sorts: {},
665
+ chartStep: 0 ,
666
+ chartTimeLabelSourceModel: ' ' ,
659
667
tableBody: JSON .parse (JSON .stringify (this .dataset .body )).map ((el , i ) => {
660
668
return {
661
669
... el,
662
670
absoluteIndex: i
663
671
}
664
672
}),
665
- tableHead: JSON .parse (JSON .stringify (this .dataset .header )).map (head => {
673
+ tableHead: JSON .parse (JSON .stringify (this .dataset .header )).map (( head , i ) => {
666
674
return {
667
675
average: Object .hasOwn (head, ' average' ) ? head .average : false ,
668
676
decimals: Object .hasOwn (head, ' decimals' ) ? head .decimals : 0 ,
@@ -677,6 +685,7 @@ export default {
677
685
suffix: Object .hasOwn (head, ' suffix' ) ? head .suffix : ' ' ,
678
686
sum: Object .hasOwn (head, ' sum' ) ? head .sum : false ,
679
687
type: head .type , // this attribute is mandatory
688
+ index: i
680
689
}
681
690
}),
682
691
filename: ' ' ,
@@ -704,6 +713,7 @@ export default {
704
713
}
705
714
})
706
715
this .filename = this .FINAL_CONFIG .style .exportMenu .filename ;
716
+ this .chartTimeLabelSourceModel = this .dateHeaders [0 ]? .name ?? ' '
707
717
},
708
718
watch: {
709
719
isExportRequest : function (bool ) {
@@ -732,7 +742,7 @@ export default {
732
742
... el,
733
743
absoluteIndex: i
734
744
}));
735
- this .tableHead = JSON .parse (JSON .stringify (newVal .header )).map (head => ({
745
+ this .tableHead = JSON .parse (JSON .stringify (newVal .header )).map (( head , i ) => ({
736
746
average: Object .hasOwn (head, ' average' ) ? head .average : false ,
737
747
decimals: Object .hasOwn (head, ' decimals' ) ? head .decimals : 0 ,
738
748
isMultiselect: Object .hasOwn (head, ' isMultiselect' ) ? head .isMultiselect : false ,
@@ -746,6 +756,7 @@ export default {
746
756
suffix: Object .hasOwn (head, ' suffix' ) ? head .suffix : ' ' ,
747
757
sum: Object .hasOwn (head, ' sum' ) ? head .sum : false ,
748
758
type: head .type ,
759
+ index: i
749
760
}));
750
761
751
762
this .currentSelectionSpan = { col: undefined , rows: [] };
@@ -782,14 +793,28 @@ export default {
782
793
}
783
794
},
784
795
computed: {
796
+ dateHeaders () {
797
+ return [... this .tableHead ].filter (th => th .type === this .constants .DATE );
798
+ },
799
+ chartTimeLabelOptions () {
800
+ return [' ' , ... this .dateHeaders .map (th => th .name )];
801
+ },
802
+ chartTimeLabelSourceIndex () {
803
+ const src = this .dateHeaders .find (th => th .name === this .chartTimeLabelSourceModel );
804
+ return src ? src .index : null ;
805
+ },
806
+ chartTimeLabels () {
807
+ if (this .chartTimeLabelSourceIndex == null ) return []
808
+ return this .visibleRows .map (r => r .td [this .chartTimeLabelSourceIndex ]);
809
+ },
785
810
availableDonutCategories () {
786
811
return Object .keys (this .multiselects ).map (index => {
787
812
return {
788
813
index,
789
814
name: this .dataset .header [index].name ,
790
815
options: this .multiselects [index],
791
816
}
792
- })
817
+ });
793
818
},
794
819
canChart () {
795
820
return this .FINAL_CONFIG .useChart && this .currentSelectionSpan .rows .length > 1 ;
@@ -849,7 +874,14 @@ export default {
849
874
stroke: lightenHexColor (textColor, 0.5 ),
850
875
labels: {
851
876
color: textColor,
852
- xAxisLabels: { show: false },
877
+ xAxisLabels: {
878
+ color: textColor,
879
+ show: this .chartTimeLabels .length ,
880
+ values: this .chartTimeLabels ,
881
+ datetimeFormatter: this .FINAL_CONFIG .style .chart .layout .datetimeFormatter ,
882
+ showOnlyAtModulo: this .FINAL_CONFIG .style .chart .layout .timeLabels .showOnlyAtModulo ,
883
+ modulo: this .FINAL_CONFIG .style .chart .layout .timeLabels .modulo
884
+ },
853
885
}
854
886
},
855
887
highlighter: {
@@ -864,7 +896,7 @@ export default {
864
896
fontSize: 18 ,
865
897
},
866
898
tooltip: {
867
- showTimeLabel: false ,
899
+ showTimeLabel: this . chartTimeLabels . length ,
868
900
backgroundOpacity: 30 ,
869
901
color: textColor,
870
902
backgroundColor: bg,
@@ -880,7 +912,13 @@ export default {
880
912
annotator: false
881
913
}
882
914
},
883
- zoom: { show: false },
915
+ zoom: {
916
+ show: this .FINAL_CONFIG .style .chart .layout .zoom .show ,
917
+ focusOnDrag: true ,
918
+ minimap: {
919
+ show: true
920
+ }
921
+ },
884
922
},
885
923
line: {
886
924
labels: {
@@ -1870,7 +1908,7 @@ export default {
1870
1908
1871
1909
.vue - ui- table- main input {
1872
1910
padding: 0 6px ;
1873
- font-family : " Satoshi "
1911
+ font- family: inherit;
1874
1912
}
1875
1913
1876
1914
.vue - ui- table- main button,
@@ -2494,4 +2532,12 @@ input.vue-ui-table-dialog-input {
2494
2532
input {
2495
2533
font- family: inherit ! important;
2496
2534
}
2535
+
2536
+ label {
2537
+ display: flex;
2538
+ flex- direction: row;
2539
+ gap: 6px ;
2540
+ align- items: center;
2541
+ font- size: 12px ;
2542
+ }
2497
2543
< / style>
0 commit comments