I have a problem with highstock : I update my graph with realtime datas.
It works perfectly when navigator is enabled.
=> official example
But when I disable navigator, update is really bugged :
...
navigator: {
enabled: false
},
...
=> Bug example
Someone has an idea why ?
OK, I found a solution :
// Add a point
self.graph.series[index].addPoint([time, parseFloat(values.last)], true, true);
// Update viewport min and max to follow updates
if ( ! self.get('showNavigator') ) {
var extremes = self.graph.xAxis[0];
self.graph.xAxis[0].setExtremes(extremes.dataMax-(extremes.oldMax-extremes.oldMin), extremes.dataMax) ;
}
Related
I want to upgrade from react-leafet v2 to v3 and can't figure out how to update the scrollWheelZoom after initilization so I can control when the map can be zoomed by mouse wheel and when not. In v2, I could simply pass a react state variable to the scrollWheelZoom prop and update the state accordingly. Since this doesn't seem to be working anymore with v3, I tried to change the option directly on the map instance from the initial value false to true:
const map = useMap();
const someEventHandler = () => {
map.options.scrollWheelZoom = true;
};
I can see that the value of map.options.scrollWheelZoom actually changed but the map is still not scrollable. What am I missing here?
I had a look into how this is done in react-leaflet's source code of v2.
So I ended up with the following which works well for me:
const setScrollWheelZoom(scrollWheelZoom: boolean) => {
if (scrollWheelZoom !== map.options.scrollWheelZoom) {
map.options.scrollWheelZoom = scrollWheelZoom;
if (scrollWheelZoom) {
map.scrollWheelZoom.enable();
} else {
map.scrollWheelZoom.disable();
}
}
}
As a side note: I am not sure though, why, in the react-leaflet source code, options.scrollWheelZoom is only set when enabling. For me, this makes the first condition fail when trying to enable it a second time.
On upgrade ag-grid version 19 from version 9, on right click tool panel option is not coming.
Also we have an icon on click we opened a tool Panel for pivot that too is not working.
This is the current code we have on click of it.
This worked well for ag-Grid 9 but not working for ag-Grid 19
this.preferencesService.togglePivot.subscribe(() => {
const isOpen = this.gridOptions.api.isToolPanelShowing();
if (isOpen) {
this.gridOptions.columnApi.setColumnState(this.saveGridState);
this.gridOptions.api.showToolPanel(false);
this.gridOptions.api.setSideBarVisible(false);
this.gridOptions.columnApi.setPivotMode(false);
// this.sideBar = false;
} else {
this.saveGridState = this.gridOptions.columnApi.getColumnState();
this.gridOptions.api.showToolPanel(true);
this.gridOptions.api.setSideBarVisible(true);
// this.sideBar = 'columns';
this.gridOptions.columnApi.setPivotMode(true);
}
});
You need to set [sideBar]="true" for the toolbar to display.
Check this updated plunk
Reference: Boolean Configuration
Update:
I tried many combinations to make it closed by default setting some parameter. Anyways, you could achieve it by using gridApi. Check the plunk, I have updated it.
onGridReady(params) {
this.gridApi = params.api;
this.gridApi.closeToolPanel();
}
Here's the details about sideBar/toolPanel configuration.
sideBar can be more than just true or false.
setSideBarVisible did not work properly for me, instead I've got toggle method which sets and unsets the sidebar as below
toggleSideBar(): void {
this.gridOptions.api.setSideBar(this.gridOptions.api.getSideBar() ? null : this.sideBar());
}
I am using ionic native transition plugin in my app. I am using slide up transition for pages.It works,but when state changes it shows the same page for a short period of time and then the other page (the page where I want to switch) appears. Here is the github link.I tried with different values for the default options, but it doesn't solve my problem. any help will be appreciated
I'm not sure if your issue is the same that I had (when transition to next/previous state begins the "new state" which it's supposed to transition to is shown in the "old view" before/during animation) but here is what I did. I found a solution which is to add a timeout to the state change in the stateGo() function in the ionic.native-transitions(.min).js which leads to it being run as the last function. The following code works on both iOS and Android devices.
function stateGo() {
var state = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];
var stateParams = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var transitionOptions = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
var stateOptions = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];
if (!state) {
$log.debug('[native transition] cannot change state without a state...');
return;
}
unregisterToStateChangeStartEvent();
transition(transitionOptions);
if (ionic.Platform.isIOS()) {
$timeout(function() {
$state.go(state, stateParams, stateOptions);
});
} else {
$state.go(state, stateParams, stateOptions);
}
}
I decided to add the check for an iOS device and run the timeout only in that case because it was only occurring in iOS devices and the timeout perhaps made Android devices flicker a little on the transition (I could be paranoid and this not really even occurring, or is due to large images on the content on my app).
Same fix probably also works in the case that you are using locationurl instead in which case you just set timeout to the "$location.url(url);" function.
Not sure if this would be the final solution for this problem but it works for now and hopefully the plugin will be fixed soon so this problem won't bother anyone else.
The same issue was on my side as well when using:
$scope.$on('$ionicView.enter', function(event, viewData) {
var transitionDirection = viewData.direction !== "back" ? "left": "right";
var options = {
"direction": transitionDirection,
"duration": 600,
"androiddelay": 75
};
window.plugins.nativepagetransitions.slide(
options,
function () {},
function () {}
);
});
However, when I changed the '$ionicView.enter' event to '$ionicView.beforeEnter', it solved the case for me. Not sure if that is a proper solution though.
This bug was referred to here: in ionic changing route causes "TypeError: Cannot read property 'scrollTo' of null"
The answer says that this bug was fixed in beta-13, but I'm using 1.0.0-rc.1 and the bug still appears.
In my case, it the error is showing when navigating back to a page that uses $ionicScrollDelegate.scrollTop()
Is anyone else getting this error after updating to rc.1?
EDIT:
I find that if I do not call $ionicScrollDelegate.scrollTop() automatically when my view loads, the error does not come up. Should I be calling scrollTop() within a specific Ionic event that waits for the right time?
Had the same problem, even with v1.0.0 "uranium-unicorn".
Wrapping the scroll call into a $timeout helped - this is what it looks like in my code:
$timeout(function() {
$ionicScrollDelegate.scrollTo(scrollPosition.left, scrollPosition.top);
}, 0);
You can just put it in
$ionicPlatform.ready(function () {
$ionicScrollDelegate.scrollTop();
})
Im late to this but was getting the same error but by calling the scroll top element with:
$ionicScrollDelegate.scrollTop();
but rather:
var scrollTop = e.detail.scrollTop;
and fixed my by using the following:
var scrollTop = $ionicScrollDelegate.getScrollPosition().top;
Im also using js scrolling as it seems to work better with the scrolla-sista plugin so I have the following in my config block at the start of my app
$ionicConfigProvider.scrolling.jsScrolling(true);
where their docs state:
Whether to use JS or Native scrolling. Defaults to native scrolling. Setting this to true has the same effect as setting each ion-content to have overflow-scroll='false'.
I hope this helps someone
For what it's worth, I saw this solution on this thread here and it worked for me with version 1.0.0-beta.14
If upgrading to version 1.0.0-beta.14 is not an option, you can change the ionic-bundle.js file with the following:
Approximately Line 39910:
this.scrollTop = function(shouldAnimate) {
this.resize().then(function() {
if(typeof scrollView !== 'undefined' && scrollView !== null){
scrollView.scrollTo(0, 0, !!shouldAnimate);
}
});
};
And Approximately line 39813:
if (!angular.isDefined(scrollViewOptions.bouncing)) {
ionic.Platform.ready(function() {
if(!scrollView){
return;
}
scrollView.options.bouncing = true;
if(ionic.Platform.isAndroid()) {
// No bouncing by default on Android
scrollView.options.bouncing = false;
// Faster scroll decel
scrollView.options.deceleration = 0.95;
}
});
}
Please change
e.detail.scrollTop
to
e.target.scrollTop
then this will Work
I'm making a mobile-app using Phonegap and HTML. Now I'm using the google maps/places autocomplete feature. The problem is: if I run it in my browser on my computer everything works fine and I choose a suggestion to use out of the autocomplete list - if I deploy it on my mobile I still get suggestions but I'm not able to tap one. It seems the "suggestion-overlay" is just ignored and I can tap on the page. Is there a possibility to put focus on the list of suggestions or something that way ?
Hope someone can help me. Thanks in advance.
There is indeed a conflict with FastClick and PAC. I found that I needed to add the needsclick class to both the pac-item and all its children.
$(document).on({
'DOMNodeInserted': function() {
$('.pac-item, .pac-item span', this).addClass('needsclick');
}
}, '.pac-container');
There is currently a pull request on github, but this hasn't been merged yet.
However, you can simply use this patched version of fastclick.
The patch adds the excludeNode option which let's you exclude DOM nodes handled by fastclick via regex. This is how I used it to make google autocomplete work with fastclick:
FastClick.attach(document.body, {
excludeNode: '^pac-'
});
This reply may be too late. But might be helpful for others.
I had the same issue and after debugging for hours, I found out this issue was because of adding "FastClick" library. After removing this, it worked as usual.
So for having fastClick and google suggestions, I have added this code in geo autocomplete
jQuery.fn.addGeoComplete = function(e){
var input = this;
$(input).attr("autocomplete" , "off");
var id = input.attr("id");
$(input).on("keypress", function(e){
var input = this;
var defaultBounds = new google.maps.LatLngBounds(
new google.maps.LatLng(37.2555, -121.9245),
new google.maps.LatLng(37.2555, -121.9245));
var options = {
bounds: defaultBounds,
mapkey: "xxx"
};
//Fix for fastclick issue
var g_autocomplete = $("body > .pac-container").filter(":visible");
g_autocomplete.bind('DOMNodeInserted DOMNodeRemoved', function(event) {
$(".pac-item", this).addClass("needsclick");
});
//End of fix
autocomplete = new google.maps.places.Autocomplete(document.getElementById(id), options);
google.maps.event.addListener(autocomplete, 'place_changed', function() {
//Handle place selection
});
});
}
if you are using Framework 7, it has a custom implementation of FastClicks. Instead of the needsclick class, F7 has no-fastclick. The function below is how it is implemented in F7:
function targetNeedsFastClick(el) {
var $el = $(el);
if (el.nodeName.toLowerCase() === 'input' && el.type === 'file') return false;
if ($el.hasClass('no-fastclick') || $el.parents('.no-fastclick').length > 0) return false;
return true;
}
So as suggested in other comments, you will only have to add the .no-fastclick class to .pac-item and in all its children
I was having the same problem,
I realized what the problem was that probably the focusout event of pac-container happens before the tap event of the pac-item (only in phonegap built-in browser).
The only way I could solve this, is to add padding-bottom to the input when it is focused and change the top attribute of the pac-container, so that the pac-container resides within the borders of the input.
Therefore when user clicks on item in list the focusout event is not fired.
It's dirty, but it works
worked perfectly for me :
$(document).on({
'DOMNodeInserted': function() {
$('.pac-item, .pac-item span', this).addClass('needsclick');
}
}, '.pac-container');
Configuration: Cordova / iOS iphone 5