Update from milestone to task Highcharts gantt - javascript

I am trying to update a milestone to a task (and vice-versa). To do so, I update the data and set milestone: true and even remove the end just to be safe.
Here you can press the button and the point should visually update (its values do) but it doesn't and I am wondering if I'm doing something wrong or if it is not doable to begging with.
Please note that we get a highcharts-gantt.src.js:48256 Uncaught TypeError: Cannot read property 'animate' of undefined.
Also, you don't get this error when updating from task to milestone.
I'm assuming this may just have been overlooked by the devs and I can probably get a workaround if I post this as an issue on the repo but maybe I'm just doing this wrong to begin with (in some cases, you aren't supposed to update directly but instead use a setSomething function).
Edit
"
Workaround(s):
When updating point, set marker.symbol = null, demo: https://jsfiddle.net/BlackLabel/oyL24bvq/
Snippet:
chart.series[0].points[0].update({
...
marker: {
symbol: null
}
});
Destroy point.graphic before updating point, demo: https://jsfiddle.net/BlackLabel/35vyhqmz/
Snippet:
chart.series[0].points[0].graphic = chart.series[0].points[0].graphic.destroy();
"
(source: https://github.com/highcharts/highcharts/issues/11158)

"
Workaround(s):
When updating point, set marker.symbol = null, demo: https://jsfiddle.net/BlackLabel/oyL24bvq/ Snippet:
chart.series[0].points[0].update({
...
marker: {
symbol: null
}
});
Destroy point.graphic before updating point, demo: https://jsfiddle.net/BlackLabel/35vyhqmz/ Snippet:
chart.series[0].points[0].graphic = chart.series[0].points[0].graphic.destroy();
"
(source: https://github.com/highcharts/highcharts/issues/11158)

Related

Error: Exception in HostFunction: Malformed calls from JS: field sizes are different. In an Animated View

As I understand this error can occur in a number of different use cases. Here is what happened in this use case
An Animated View is being controlled by a PanResponder and this is reset at certain intervals to create an infinite scroll effect.
Compiles and runs perfectly and functions as intended.
Small gestures (almost like a tap) ie. pixel movements of about +- 4dx/ 4 dy the code crashes with the error in the title.
The error is thrown in the Child View of the PanResponsder with the mismatch resulting from the translate: [{transform}] I believe.
Why does the code function fine except for smaller gestures? What casuses the error?
I ended up resolving the issue.
In this case, it was specific to a PanResponder, but I believe this can occur in other situations as well, the error tracking should be similar. A moveY variable on the PanResponder went beyond a threshold set elsewhere. This resulted in translateY being set to NaN which threw the above error. This results in a mismatch in props.
If others experience this issue my advice would be to identify the specific component experiencing the mismatch. (In this case PanResponder)
Isolate the props (set defaults/ dummy values) and ensure that each prop is resolved correctly (especially in Animated transform: translatex/translateY )
Trace the prop responsible and adjust the logic specific to that prop to avoid NaNs and undefined being passed.
I got this error when i mistakenly passed a closure as a second argument to AsyncStorage instead of the string literal i needed to store
AsyncStorage.setItem('loggedIn', (err, result) => {
console.log('I am logged In');
});
The correct thing to do is
AsyncStorage.setItem('loggedIn', 'my-jwt-token', (err, result) => {
console.log('I am logged In');
});
I was facing similar issue and solved it by changing easing value from elastic to other method. Yeah ! weird but solved the issue just incase it might be helpful to someone.
Animated.timing(height, {
toValue: 500,
duration: 1500,
easing: Easing.elastic,
}).start();
TO
Animated.timing(height, {
toValue: 500,
duration: 1500,
easing: Easing.linear,
}).start();
My issue was that I was using Easing.inOut itself without passing another easing function inside, like Easing.inOut(Easing.elastic(1)). I thought Easing.inOut was an ease in itself but it actually just makes whatever easing function you pass into it symmetric. Easing.in and Easing.out similarly make whatever you pass into them run forwards or backwards. See https://reactnative.dev/docs/easing
In my case, I was passing an entire response object to an analytics tool, but it wasn't JSON.stringify-able.
that error appeared to me when I passed a wrong type value as date to this peace of code
PushNotification.localNotificationSchedule({
channelId: 'channel-id', // (required) channelId, if the channel doesn't exist, notification will not trigger.
title: 'My Notification Title', // (optional)
message: 'My Notification Message', // (required)
date: date, // in 60 secs
allowWhileIdle: false, // (optional) set notification to work while on doze, default: false
repeatTime: 1, // (optional) Increment of configured repeatType. Check 'Repeating Notifications' section for more info.
});
I don't know if its relevent or not but in my case, this error was occuring when i was doing this in react native ->
Alert.alert("Error", error, [ { text: "OK", }, ]);
instead of this ->
Alert.alert("Error", error.message, [ { text: "OK", }, ]);
so that's means pass the correct data type and error will get resolve.
In my case I got this error when I was accidentally passing NaN to width property of a component.
So double check that all your data is in the expected/correct format at different stages of state updates.

Avoid declaring large object in getDefaultProps prior to an event

The title might not be the best way to describe the problem, but I was wondering if there was a better practice to declaring an object in getDefaultProps?
In my render method I call several keys from from a prop/state that get updated on a click event i.e. this.props.player.name. The problem is that on page load this.props.player is blank and calling .name errors out. I know I can do something like ...
getDefaultProps: function() {
return {
player: {
name: null,
team: null
position: null
}
};
}
but it doesn't feel right. I was hoping there might be something similar to how Ruby does .try() where it won't try to call a method on a undefined prop.
The problem is specifically that this.props.player is undefined, if you define an empty object it will prevent the error from occurring. It's not bad practice to stub out the keys you're anticipating, but setting the default value to {} will be enough to prevent it from throwing.
You can create your data from ImmutableJS. Then you can get any part of your data like this:
this.state.getIn(['player', 'name', ...])
or
this.state.get('player')
This will not throw error even player is not defined or other, it will return undefined (or null) I don't remember
The update and updateIn work the same
see the doc here
I'd like to add this vanilla JS solution too - var x = (user || {}).name;
Source

KnockoutJS - Select dropdown binding not working

Im working on a project to build a CRUD system using knockout and getting and saving my data via AJAX. Been having issues binding the select dropdown. When I try to edit an incident I get the following error:
Uncaught TypeError: Cannot read property 'push' of undefined
I created a jsfiddle http://jsfiddle.net/rqwku4kb/20/ to demonstrate the issue. I'm still working on the delete and add a new incident link so they are not working yet but im working on that seperately.
Here is the code that`s causing me issues at the moment.
self.ShowMeTheCurrentSelectedIncident = function(data) {
self.currentIncident();
self.chosen_composante.push([data.Composante]);
};
Would anyone have have any idea where the issue might be or be able to provide me some advice?
The method here is what's wrong:
self.ShowMeTheCurrentSelectedIncident = function(data) {
self.currentIncident(); // (1)
self.chosen_composante.push([data.Composante]); // (2)
};
What this does:
(1) get the value of the observable currentIncident and then throw it away. It's always null and never set so this is doubly redundant.
(2) Reference an undefined variable called chosen_composante which does not exist in IncidentList.
I could not fix this for you since I wasn't sure what values were to go where, but it should be enough to set you on the right track - you're confusing the properties of the IncidentList and Incident

Query on pointer to same class in parse

I have a subclass called TreeFolderObject. One of the column headings is called "parent" and is a pointer field. It points to other another object in the same class. Here is the stripped down code I am using to attempt to read data from this structure:
var TreeFolderObject = Parse.Object.extend('TreeFolderObject');
var folderQuery = new Parse.Query(TreeFolderObject);
folderQuery.include("parent");
folderQuery.find().then(function(results) {
for (i in results) {
treeData.push({
title: results[i].get('folderName'),
objectId: results[i].id,
parent: results[i].get("parent")
});
console.log(results[i].get("parent").get("folderName") );
}
},
function(error) {
console.log("failed, with error code: " + error);
}
);
The console line reports the following output:
Uncaught TypeError: Cannot read property 'get' of undefined
I have also tried shortening the console.log line to just:
console.log(results[i].get("parent") );
and this reports the following:
undefined
index.html:100
ParseObjectSubclass {className: "TreeFolderObject", _objCount: 32, id: "oq5o2zFqIM"}
index.html:100 ParseObjectSubclass {className: "TreeFolderObject", _objCount: 24, id: "oq5o2zFqIM"}
index.html:100 ParseObjectSubclass {className: "TreeFolderObject", _objCount: 41, id: "oq5o2zFqIM"}
etc
This indicates that the browser client is obtaining the information I am after. I just can't work out how to get the data "out", if that makes sense.
Ultimately, I want to identify the parent object of each object so I can iterate through the class.
What I am doing wrong? I have tried searching here and on the web in general and there are a lot of very similar questions. This is obviously a confusing topic. I just can't work it out though and any help would be much appreciated. How do I get the console to print out the folderName property of the parent object?
Here's a screenshot of the parse control panel, if that helps:
enter image description here
Add "var" in front of i like this
var TreeFolderObject = Parse.Object.extend('TreeFolderObject');
var folderQuery = new Parse.Query(TreeFolderObject);
folderQuery.include("parent");
folderQuery.find().then(function(results) {
for (var i in results) {
treeData.push({
title: results[i].get('folderName'),
objectId: results[i].id,
parent: results[i].get("parent")
});
console.log(results[i].get("parent").get("folderName") );
}
},
function(error) {
console.log("failed, with error code: " + error);
}
);
Answering my own question here:
I eventually discovered the answer, and its got nothing to do with labeling i as a var, or the fact that I'm querying the same class. The solution is to put a condition line in the query. In other words, insert this after the first two lines of the code I posted earlier:
folderQuery.exists("parent");
In my case every object in the class, apart from one, has a parent, so this works fine. What I don't understand is why it should be necessary to put a condition on the query at all, if I'm intending to query the entire class.
I discovered the solution after browsing lots of parse pointer related questions on StackOverflow. No one else seems to have fallen into the exact same trap of leaving out the condition line, and eventually I realised that my parse query wasn't following the convention. If this realisation helps anyone else out there, I will be happy to have helped!
If anyone can help with an explanation as to why I need to put a condition line in, even though I'm querying the entire class, please let me know. In the meantime, I'm happy to have found this solution as it was holding up development of my project.

How to toggle visibility property (billboard.show) of a CZML entity's billboard?

According to the Cesium API, to toggle the visibility of an asset's billboard (or label) you can simply assign the billboard.show property to false. When I attempted to do this, Cesium would error with
An error occurred while rendering. Rendering has stopped.
TypeError: undefined is not a function
...
This discussion from the cesium-dev google group includes some example code to toggle billboard visibility on/off. The same code does not work if you attempt show = false on an entity from CZML (this example does not use CZML).
Here is what I tried
var asset = loadedCZML.entities.getById(id);
asset.billboard.show = false; //Error!
(loadedCZML is a Cesium.CzmlDataSource)
The API doc's don't mention that the show property of your entity might not always be a simple boolean property (as the API describes).
When working with a CzmlDataSource's entity, the show property is considered a TimeIntervalCollectionProperty (at least it was with my CZML).
All properties in Cesium must implement a getValue function, and when you go to set your show = false, the setter for the property is unable to apply false to a TimeIntervalCollectionProperty and instead replaces the entire property with a simple value of false.
The error undefined is not a function is a result of the cesium render call attempting to call getValue() on our show property. Regardless, the fix is simple:
Instead of this:
asset.billboard.show = false; //error
Do this:
asset.billboard.show = new Cesium.ConstantProperty(false);
PS: This applies for other Cesium properties, see the following example:
entity.billboard.image = pinBuilder.fromColor(Cesium.Color.CRIMSON, 48); //error
//do this instead
entity.billboard.image = new Cesium.ConstantProperty(pinBuilder.fromColor(Cesium.Color.CRIMSON, 48).toDataURL());

Categories

Resources