File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,10 +38,15 @@ export default function Chart({
3838 return ;
3939 }
4040
41+ const keepZoom =
42+ currentTimeDomain . current ?. start === timeDomain . start &&
43+ currentTimeDomain . current ?. end === timeDomain . end &&
44+ currentTimeDomain . current ?. type === timeDomain . type ;
4145 const props : HtmlProps = {
4246 width,
4347 height,
4448 locale,
49+ keepZoom,
4550 datasets,
4651 timeDomain,
4752 noDataString,
@@ -139,6 +144,7 @@ type HtmlProps = {
139144 zoomEnabled : boolean ;
140145 height : number ;
141146 width : number ;
147+ keepZoom : boolean ;
142148 marginHorizontal : number ;
143149 locale : string ;
144150 timeDomain : TimeDomain ;
Original file line number Diff line number Diff line change @@ -345,8 +345,7 @@ window.draw = props => {
345345 const newScale =
346346 !x ||
347347 !wholeScaleX ||
348- zoomEnabled !== props.zoomEnabled ||
349- timeDomain !== props.timeDomain
348+ !props.keepZoom
350349 zoomEnabled = props.zoomEnabled
351350 timeDomain = props.timeDomain
352351 if (newScale) {
@@ -769,6 +768,10 @@ window.draw = props => {
769768 }
770769
771770 updateHighlight(newScale ? 0 : 300)
771+
772+ if (!newScale && props.keepZoom) {
773+ rescaleY({ sourceEvent: null })
774+ }
772775 } catch (e) {
773776 postMessage('error', e.message)
774777 }
@@ -784,4 +787,4 @@ console.log = (...args) => {
784787}
785788
786789true
787- `
790+ ` ;
You can’t perform that action at this time.
0 commit comments