@@ -177,6 +177,8 @@ export default defineComponent({
177177 }).join (' ' )} ` ;
178178 });
179179
180+ let switchingTimeRange = false ;
181+
180182 watch (() => [
181183 props .currency ,
182184 props .timeRange ,
@@ -199,6 +201,7 @@ export default defineComponent({
199201
200202 if (oldTimeRange !== timeRange ) {
201203 // Clear chart when switching time range
204+ switchingTimeRange = true ;
202205 history .value = [];
203206 }
204207
@@ -217,15 +220,17 @@ export default defineComponent({
217220 );
218221 });
219222
220- watch (async () => {
223+ watch (history , async () => {
221224 if (! $path .value ) return ;
225+ if (! switchingTimeRange ) return ;
222226 // animate the chart line
223227 if (history .value .length ) {
224228 const pathLength = $path .value .getTotalLength ();
225229 $path .value .style .strokeDasharray = ` 0 ${pathLength } ` ;
226230 await new Promise ((resolve ) => requestAnimationFrame (resolve )); // strokeDasharray gets applied
227231 await new Promise ((resolve ) => requestAnimationFrame (resolve )); // ready to update strokeDasharray again
228232 $path .value .style .strokeDasharray = ` ${pathLength } 0 ` ;
233+ switchingTimeRange = false ;
229234 } else {
230235 $path .value .style .strokeDasharray = ' ' ;
231236 }
@@ -261,7 +266,7 @@ svg {
261266}
262267
263268svg path {
264- transition : stroke-dasharray 1.5 s linear ;
269+ transition : stroke-dasharray 1.2 s linear ;
265270}
266271
267272.timespan {
@@ -304,8 +309,4 @@ svg path {
304309.change.positive ::before {
305310 content : ' +' ;
306311}
307-
308- .change.negative {
309- color : var (--nimiq-red );
310- }
311312 </style >
0 commit comments