523523
524524 <!-- BAR | LINE CHARTS -->
525525 <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 >
526532 <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" />
529535 </div >
530536 <div v-if =" currentSelectionSpan.rows.length >= 2" class =" chart-trend"
531537 :style =" `color:${FINAL_CONFIG.style.chart.modal.color}`" >
532538 <span >---</span > Trend: {{ dataLabel({
533- v: chartData.progression.trend,
539+ v: chartData.progression.trend * 100 ,
534540 s: '%',
535541 r: 1
536542 }) }}
@@ -656,13 +662,15 @@ export default {
656662 showChart: false ,
657663 showDonutOptions: false ,
658664 sorts: {},
665+ chartStep: 0 ,
666+ chartTimeLabelSourceModel: ' ' ,
659667 tableBody: JSON .parse (JSON .stringify (this .dataset .body )).map ((el , i ) => {
660668 return {
661669 ... el,
662670 absoluteIndex: i
663671 }
664672 }),
665- tableHead: JSON .parse (JSON .stringify (this .dataset .header )).map (head => {
673+ tableHead: JSON .parse (JSON .stringify (this .dataset .header )).map (( head , i ) => {
666674 return {
667675 average: Object .hasOwn (head, ' average' ) ? head .average : false ,
668676 decimals: Object .hasOwn (head, ' decimals' ) ? head .decimals : 0 ,
@@ -677,6 +685,7 @@ export default {
677685 suffix: Object .hasOwn (head, ' suffix' ) ? head .suffix : ' ' ,
678686 sum: Object .hasOwn (head, ' sum' ) ? head .sum : false ,
679687 type: head .type , // this attribute is mandatory
688+ index: i
680689 }
681690 }),
682691 filename: ' ' ,
@@ -704,6 +713,7 @@ export default {
704713 }
705714 })
706715 this .filename = this .FINAL_CONFIG .style .exportMenu .filename ;
716+ this .chartTimeLabelSourceModel = this .dateHeaders [0 ]? .name ?? ' '
707717 },
708718 watch: {
709719 isExportRequest : function (bool ) {
@@ -732,7 +742,7 @@ export default {
732742 ... el,
733743 absoluteIndex: i
734744 }));
735- this .tableHead = JSON .parse (JSON .stringify (newVal .header )).map (head => ({
745+ this .tableHead = JSON .parse (JSON .stringify (newVal .header )).map (( head , i ) => ({
736746 average: Object .hasOwn (head, ' average' ) ? head .average : false ,
737747 decimals: Object .hasOwn (head, ' decimals' ) ? head .decimals : 0 ,
738748 isMultiselect: Object .hasOwn (head, ' isMultiselect' ) ? head .isMultiselect : false ,
@@ -746,6 +756,7 @@ export default {
746756 suffix: Object .hasOwn (head, ' suffix' ) ? head .suffix : ' ' ,
747757 sum: Object .hasOwn (head, ' sum' ) ? head .sum : false ,
748758 type: head .type ,
759+ index: i
749760 }));
750761
751762 this .currentSelectionSpan = { col: undefined , rows: [] };
@@ -782,14 +793,28 @@ export default {
782793 }
783794 },
784795 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+ },
785810 availableDonutCategories () {
786811 return Object .keys (this .multiselects ).map (index => {
787812 return {
788813 index,
789814 name: this .dataset .header [index].name ,
790815 options: this .multiselects [index],
791816 }
792- })
817+ });
793818 },
794819 canChart () {
795820 return this .FINAL_CONFIG .useChart && this .currentSelectionSpan .rows .length > 1 ;
@@ -849,7 +874,14 @@ export default {
849874 stroke: lightenHexColor (textColor, 0.5 ),
850875 labels: {
851876 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+ },
853885 }
854886 },
855887 highlighter: {
@@ -864,7 +896,7 @@ export default {
864896 fontSize: 18 ,
865897 },
866898 tooltip: {
867- showTimeLabel: false ,
899+ showTimeLabel: this . chartTimeLabels . length ,
868900 backgroundOpacity: 30 ,
869901 color: textColor,
870902 backgroundColor: bg,
@@ -880,7 +912,13 @@ export default {
880912 annotator: false
881913 }
882914 },
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+ },
884922 },
885923 line: {
886924 labels: {
@@ -1870,7 +1908,7 @@ export default {
18701908
18711909.vue - ui- table- main input {
18721910 padding: 0 6px ;
1873- font-family : " Satoshi "
1911+ font- family: inherit;
18741912}
18751913
18761914.vue - ui- table- main button,
@@ -2494,4 +2532,12 @@ input.vue-ui-table-dialog-input {
24942532input {
24952533 font- family: inherit ! important;
24962534}
2535+
2536+ label {
2537+ display: flex;
2538+ flex- direction: row;
2539+ gap: 6px ;
2540+ align- items: center;
2541+ font- size: 12px ;
2542+ }
24972543< / style>
0 commit comments