@@ -914,85 +914,89 @@ const presets = [
914
914
{ key: ' advanced' , title: ' Advanced' },
915
915
];
916
916
917
+ function getBaseConfig() {
918
+ return {
919
+ // Basic Values
920
+ value: 67 ,
921
+ min: 0 ,
922
+ max: 100 ,
923
+ decimals: 0 ,
924
+ symbol: ' ' ,
925
+ reverse: false ,
926
+
927
+ // Dimensions
928
+ width: 400 ,
929
+ height: 320 ,
930
+ relativeGaugeSize: false ,
931
+ gaugeWidthScale: 1.0 ,
932
+
933
+ // Colors
934
+ gaugeColor: ' #edebeb' ,
935
+ valueFontColor: ' #010101' ,
936
+ labelFontColor: ' #b3b3b3' ,
937
+ levelColors: [' #a9d70b' , ' #f9c802' , ' #ff0000' ],
938
+ noGradient: false ,
939
+ showSectorColors: false ,
940
+ customSectors: {
941
+ percents: false ,
942
+ ranges: [
943
+ { lo: 0 , hi: 50 , color: ' #a9d70b' },
944
+ { lo: 50 , hi: 80 , color: ' #f9c802' },
945
+ { lo: 80 , hi: 100 , color: ' #ff0000' },
946
+ ],
947
+ },
948
+
949
+ // Labels and Text
950
+ title: ' ' ,
951
+ titleFontColor: ' #010101' ,
952
+ titleFontFamily: ' Arial' ,
953
+ titleFontWeight: ' bold' ,
954
+ titlePosition: ' above' ,
955
+ label: ' units' ,
956
+ minTxt: ' ' ,
957
+ maxTxt: ' ' ,
958
+ hideValue: false ,
959
+ hideMinMax: false ,
960
+ humanFriendly: false ,
961
+ formatNumber: false ,
962
+
963
+ // Gauge Types
964
+ donut: false ,
965
+ donutStartAngle: 90 ,
966
+ differential: false ,
967
+ displayRemaining: false ,
968
+
969
+ // Pointer
970
+ pointer: false ,
971
+ pointerOptions: {
972
+ color: ' #8e2de2' ,
973
+ toplength: 14 ,
974
+ bottomlength: 27 ,
975
+ bottomwidth: 4 ,
976
+ },
977
+
978
+ // Target Line
979
+ showTargetLine: false ,
980
+ targetLine: null as number | null ,
981
+ targetLineColor: ' #000000' ,
982
+ targetLineWidth: 1.5 ,
983
+
984
+ // Animation
985
+ startAnimationTime: 700 ,
986
+ startAnimationType: ' >' ,
987
+ refreshAnimationTime: 700 ,
988
+ counter: false ,
989
+
990
+ // Shadow
991
+ showInnerShadow: false ,
992
+ shadowOpacity: 0.2 ,
993
+ shadowSize: 5 ,
994
+ shadowVerticalOffset: 3 ,
995
+ };
996
+ }
997
+
917
998
// Comprehensive Configuration (all features from visual-diff-tool)
918
- const config = reactive ({
919
- // Basic Values
920
- value: 67 ,
921
- min: 0 ,
922
- max: 100 ,
923
- decimals: 0 ,
924
- symbol: ' ' ,
925
- reverse: false ,
926
-
927
- // Dimensions
928
- width: 400 ,
929
- height: 320 ,
930
- relativeGaugeSize: false ,
931
- gaugeWidthScale: 1.0 ,
932
-
933
- // Colors
934
- gaugeColor: ' #edebeb' ,
935
- valueFontColor: ' #010101' ,
936
- labelFontColor: ' #b3b3b3' ,
937
- levelColors: [' #a9d70b' , ' #f9c802' , ' #ff0000' ],
938
- noGradient: false ,
939
- showSectorColors: false ,
940
- customSectors: {
941
- percents: false ,
942
- ranges: [
943
- { lo: 0 , hi: 50 , color: ' #a9d70b' },
944
- { lo: 50 , hi: 80 , color: ' #f9c802' },
945
- { lo: 80 , hi: 100 , color: ' #ff0000' },
946
- ],
947
- },
948
-
949
- // Labels and Text
950
- title: ' ' ,
951
- titleFontColor: ' #010101' ,
952
- titleFontFamily: ' Arial' ,
953
- titleFontWeight: ' bold' ,
954
- titlePosition: ' above' ,
955
- label: ' units' ,
956
- minTxt: ' ' ,
957
- maxTxt: ' ' ,
958
- hideValue: false ,
959
- hideMinMax: false ,
960
- humanFriendly: false ,
961
- formatNumber: false ,
962
-
963
- // Gauge Types
964
- donut: false ,
965
- donutStartAngle: 90 ,
966
- differential: false ,
967
- displayRemaining: false ,
968
-
969
- // Pointer
970
- pointer: false ,
971
- pointerOptions: {
972
- color: ' #8e2de2' ,
973
- toplength: 14 ,
974
- bottomlength: 27 ,
975
- bottomwidth: 4 ,
976
- },
977
-
978
- // Target Line
979
- showTargetLine: false ,
980
- targetLine: null as number | null ,
981
- targetLineColor: ' #000000' ,
982
- targetLineWidth: 1.5 ,
983
-
984
- // Animation
985
- startAnimationTime: 700 ,
986
- startAnimationType: ' >' ,
987
- refreshAnimationTime: 700 ,
988
- counter: false ,
989
-
990
- // Shadow
991
- showInnerShadow: false ,
992
- shadowOpacity: 0.2 ,
993
- shadowSize: 5 ,
994
- shadowVerticalOffset: 3 ,
995
- });
999
+ let config = reactive (getBaseConfig ());
996
1000
997
1001
const animationTypes = [
998
1002
{ title: ' Linear' , value: ' linear' },
@@ -1032,18 +1036,20 @@ const gauge = new JustGage(config);`;
1032
1036
const loadPreset = (preset : string ) => {
1033
1037
switch (preset ) {
1034
1038
case ' donut' :
1035
- Object .assign (config , {
1039
+ config = {
1040
+ ... getBaseConfig (),
1036
1041
donut: true ,
1037
1042
donutStartAngle: 90 ,
1038
1043
hideMinMax: true ,
1039
1044
value: 75 ,
1040
1045
label: ' Progress' ,
1041
1046
levelColors: [' #00ff66' , ' #ffcc00' , ' #ff3300' ],
1042
- }) ;
1047
+ };
1043
1048
break ;
1044
1049
1045
1050
case ' pointer' :
1046
- Object .assign (config , {
1051
+ config = {
1052
+ ... getBaseConfig (),
1047
1053
pointer: true ,
1048
1054
donut: false ,
1049
1055
value: 60 ,
@@ -1054,42 +1060,46 @@ const loadPreset = (preset: string) => {
1054
1060
bottomlength: 30 ,
1055
1061
bottomwidth: 6 ,
1056
1062
},
1057
- }) ;
1063
+ };
1058
1064
break ;
1059
1065
1060
1066
case ' differential' :
1061
- Object .assign (config , {
1067
+ config = {
1068
+ ... getBaseConfig (),
1062
1069
differential: true ,
1063
1070
min: - 50 ,
1064
1071
max: 50 ,
1065
1072
value: 25 ,
1066
1073
label: ' Differential' ,
1067
1074
levelColors: [' #ff0000' , ' #ffff00' , ' #00ff00' ],
1068
- }) ;
1075
+ };
1069
1076
break ;
1070
1077
1071
1078
case ' custom-sectors' :
1072
- Object .assign (config , {
1079
+ config = {
1080
+ ... getBaseConfig (),
1073
1081
noGradient: true ,
1074
1082
showSectorColors: true ,
1075
1083
pointer: true ,
1076
1084
value: 80 ,
1077
1085
label: ' Custom Sectors' ,
1078
- }) ;
1086
+ };
1079
1087
break ;
1080
1088
1081
1089
case ' minimal' :
1082
- Object .assign (config , {
1090
+ config = {
1091
+ ... getBaseConfig (),
1083
1092
hideMinMax: true ,
1084
1093
title: ' ' ,
1085
1094
label: ' ' ,
1086
1095
showInnerShadow: false ,
1087
1096
levelColors: [' #999999' ],
1088
- }) ;
1097
+ };
1089
1098
break ;
1090
1099
1091
1100
case ' advanced' :
1092
- Object .assign (config , {
1101
+ config = {
1102
+ ... getBaseConfig (),
1093
1103
pointer: true ,
1094
1104
showTargetLine: true ,
1095
1105
targetLine: 75 ,
@@ -1098,67 +1108,11 @@ const loadPreset = (preset: string) => {
1098
1108
humanFriendly: true ,
1099
1109
title: ' Advanced Gauge' ,
1100
1110
label: ' Performance' ,
1101
- }) ;
1111
+ };
1102
1112
break ;
1103
1113
1104
1114
default : // 'default'
1105
- Object .assign (config , {
1106
- value: 67 ,
1107
- min: 0 ,
1108
- max: 100 ,
1109
- decimals: 0 ,
1110
- symbol: ' ' ,
1111
- reverse: false ,
1112
- width: 400 ,
1113
- height: 320 ,
1114
- relativeGaugeSize: false ,
1115
- gaugeWidthScale: 1.0 ,
1116
- gaugeColor: ' #edebeb' ,
1117
- valueFontColor: ' #010101' ,
1118
- labelFontColor: ' #b3b3b3' ,
1119
- levelColors: [' #a9d70b' , ' #f9c802' , ' #ff0000' ],
1120
- noGradient: false ,
1121
- title: ' ' ,
1122
- label: ' units' ,
1123
- minTxt: ' ' ,
1124
- maxTxt: ' ' ,
1125
- hideValue: false ,
1126
- hideMinMax: false ,
1127
- humanFriendly: false ,
1128
- formatNumber: false ,
1129
- donut: false ,
1130
- donutStartAngle: 90 ,
1131
- differential: false ,
1132
- displayRemaining: false ,
1133
- pointer: false ,
1134
- pointerOptions: {
1135
- color: ' #8e2de2' ,
1136
- toplength: 14 ,
1137
- bottomlength: 27 ,
1138
- bottomwidth: 4 ,
1139
- },
1140
- showTargetLine: false ,
1141
- targetLine: null ,
1142
- targetLineColor: ' #000000' ,
1143
- targetLineWidth: 1.5 ,
1144
- startAnimationTime: 700 ,
1145
- startAnimationType: ' >' ,
1146
- refreshAnimationTime: 700 ,
1147
- counter: false ,
1148
- showInnerShadow: false ,
1149
- shadowOpacity: 0.2 ,
1150
- shadowSize: 5 ,
1151
- shadowVerticalOffset: 3 ,
1152
- showSectorColors: false ,
1153
- customSectors: {
1154
- percents: false ,
1155
- ranges: [
1156
- { lo: 0 , hi: 50 , color: ' #a9d70b' },
1157
- { lo: 50 , hi: 80 , color: ' #f9c802' },
1158
- { lo: 80 , hi: 100 , color: ' #ff0000' },
1159
- ],
1160
- },
1161
- });
1115
+ config = getBaseConfig ();
1162
1116
}
1163
1117
1164
1118
// Trigger immediate update
0 commit comments