651651
652652 <!-- DATA TABLE -->
653653 <div :style =" `${isPrinting ? '' : 'max-height:400px'};overflow:auto;width:100%;margin-top:48px`" v-if =" mutableConfig.showTable" >
654+ <div style =" display : flex ; flex-direction :row ; gap : 6px ; align-items :center ; padding-left : 6px " data-html2canvas-ignore >
655+ <input type =" checkbox" v-model =" showSparklineTable" >
656+ <div @click =" showSparklineTable = !showSparklineTable" style =" cursor : pointer " >
657+ <BaseIcon name =" chartLine" :size =" 20" :stroke =" chartConfig.chart.color" />
658+ </div >
659+ </div >
660+ <TableSparkline v-if =" showSparklineTable" :dataset =" tableSparklineDataset" :config =" tableSparklineConfig" />
654661 <DataTable
662+ v-else
655663 :colNames =" dataTable.colNames"
656664 :head =" dataTable.head"
657665 :body =" dataTable.body"
@@ -701,6 +709,7 @@ import Tooltip from "../atoms/Tooltip.vue";
701709import UserOptions from " ../atoms/UserOptions.vue" ;
702710import Shape from " ../atoms/Shape.vue" ;
703711import BaseIcon from ' ../atoms/BaseIcon.vue' ;
712+ import TableSparkline from " ./vue-ui-table-sparkline.vue" ;
704713
705714const uid = createUid ();
706715
@@ -726,7 +735,8 @@ export default {
726735 Title,
727736 Tooltip,
728737 UserOptions,
729- BaseIcon
738+ BaseIcon,
739+ TableSparkline
730740},
731741 data (){
732742 const uniqueId = uid;
@@ -735,6 +745,8 @@ export default {
735745 start: 0 ,
736746 end: maxX,
737747 }
748+ const showSparklineTable = this .config .table .sparkline || true ;
749+
738750 return {
739751 CTX : null ,
740752 CANVAS : null ,
@@ -775,7 +787,8 @@ export default {
775787 step: 0 ,
776788 slicer,
777789 __to__: null ,
778- maxX
790+ maxX,
791+ showSparklineTable
779792 }
780793 },
781794 computed: {
@@ -837,6 +850,53 @@ export default {
837850 }
838851 }).filter (s => ! this .segregatedSeries .includes (s .id ));
839852 },
853+ tableSparklineDataset () {
854+ return this .relativeDataset .map (ds => {
855+ return {
856+ id: ds .id ,
857+ name: ds .name ,
858+ color: ds .color ,
859+ values: ds .absoluteValues .slice (this .slicer .start , this .slicer .end ),
860+ }
861+ })
862+ },
863+ tableSparklineConfig () {
864+ return {
865+ responsiveBreakpoint: this .chartConfig .table .responsiveBreakpoint ,
866+ roundingAverage: this .chartConfig .table .rounding ,
867+ roundingMedian: this .chartConfig .table .rounding ,
868+ roundingValues: this .chartConfig .table .rounding ,
869+ roundingTotal: this .chartConfig .table .rounding ,
870+ fontFamily: this .chartConfig .chart .fontFamily ,
871+ colNames: this .chartConfig .chart .grid .labels .xAxisLabels .values ,
872+ title: {
873+ backgroundColor: this .chartConfig .chart .backgroundColor ,
874+ text: this .chartConfig .chart .title .text ,
875+ fontSize: this .chartConfig .chart .title .fontSize ,
876+ color: this .chartConfig .chart .title .color ,
877+ bold: this .chartConfig .chart .title .bold ,
878+ subtitle: {
879+ text: this .chartConfig .chart .title .subtitle .text ,
880+ color: this .chartConfig .chart .title .subtitle .color ?? ' #CCCCCC' ,
881+ fontSize: this .chartConfig .chart .title .fontSize ,
882+ bold: this .chartConfig .chart .title .bold ,
883+ }
884+ },
885+ thead: {
886+ backgroundColor: this .chartConfig .table .th .backgroundColor ,
887+ color: this .chartConfig .table .th .color ,
888+ outline: this .chartConfig .table .th .outline
889+ },
890+ tbody: {
891+ backgroundColor: this .chartConfig .table .td .backgroundColor ,
892+ color: this .chartConfig .table .td .color ,
893+ outline: this .chartConfig .table .td .outline
894+ },
895+ userOptions: {
896+ show: false
897+ }
898+ }
899+ },
840900 absoluteDataset () {
841901 return this .safeDataset .map ((datapoint , i ) => {
842902 return {
0 commit comments