@@ -77,8 +77,7 @@ ChartJS.register(
77
77
const sfc = {
78
78
components: { Line },
79
79
data : () => ({
80
- data: {
81
- },
80
+ data: {},
82
81
83
82
masterChartData: window .config .pageData .repoContributorsCommitStats || [],
84
83
type: window .config .pageData .contributionType ,
@@ -98,6 +97,19 @@ const sfc = {
98
97
enabled: true ,
99
98
mode: " x" ,
100
99
threshold: 20 ,
100
+
101
+ onPan : function (event ) {
102
+ var minVal = event .chart .options .scales .x .min ;
103
+ var maxVal = event .chart .options .scales .x .max ;
104
+
105
+ Object .values (ChartJS .instances ).forEach (function (instance ) {
106
+ if (instance !== event .chart ){
107
+ instance .options .scales .x .min = minVal;
108
+ instance .options .scales .x .max = maxVal;
109
+ instance .update ();
110
+ }
111
+ });
112
+ },
101
113
},
102
114
limits: {
103
115
x: {
@@ -114,6 +126,20 @@ const sfc = {
114
126
enabled: true ,
115
127
},
116
128
mode: " x" ,
129
+
130
+ onZoomComplete : function (event ) {
131
+ var minVal = event .chart .options .scales .x .min ;
132
+ var maxVal = event .chart .options .scales .x .max ;
133
+
134
+ Object .values (ChartJS .instances ).forEach (function (instance ) {
135
+ if (instance !== event .chart ){
136
+ instance .options .scales .x .min = minVal;
137
+ instance .options .scales .x .max = maxVal;
138
+ instance .update ();
139
+ }
140
+ });
141
+ },
142
+
117
143
},
118
144
},
119
145
},
@@ -130,7 +156,7 @@ const sfc = {
130
156
max: this .maxMainGraph (),
131
157
},
132
158
},
133
- }
159
+ };
134
160
},
135
161
mainGraphData () {
136
162
return {
@@ -162,12 +188,14 @@ const sfc = {
162
188
},
163
189
methods: {
164
190
maxMainGraph () {
165
- const maxValue = Math .max (... this .masterChartData [" " ].weeks .map (o => o[this .type ]))
166
- const [cooefficient , exp ] = maxValue .toExponential ().split (' e' )
191
+ const maxValue = Math .max (
192
+ ... this .masterChartData [" " ].weeks .map ((o ) => o[this .type ])
193
+ );
194
+ const [cooefficient , exp ] = maxValue .toExponential ().split (" e" );
167
195
if (Number (cooefficient) % 1 == 0 ) {
168
- return maxValue
196
+ return maxValue;
169
197
}
170
- return (1 - Number (cooefficient) % 1 ) * 10 ** Number (exp) + maxValue
198
+ return (1 - ( Number (cooefficient) % 1 )) * 10 ** Number (exp) + maxValue;
171
199
},
172
200
additions (data ) {
173
201
return Object .values (data).reduce ((acc , item ) => {
0 commit comments