Changing csv url in zingchart - zingchart

I have a page that clients can upload their csv files, save it to the server, then ajax will pass the location of the csv.
Question is I can't find a way for zingchart to reload with a new csv url, tried many ways in the document, below is my uncomplete code, don't know if there is any method in zingchart.exec can achieve this. Thanks for any suggestions or help
$.ajax({
type: 'POST',
url: '/upload_csv',
data: form_data,
contentType: false,
cache: false,
processData: false,
success: function(data) {
zingchart.exec('chartjs-line', 'modifyplot', {
data:{
csv: {
url: data.csv_url,
verticalLabels: true,
}
};
}
});
});

You should be able to do this with the modify function, the same way you have it set up currently. modifyplot targets the plot object within your graph object; csv should be a member of your graph object.
If you have any other issues, the fastest way to get support is emailing support#zingsoft.com or starting a chat with us on our site!

Related

Google Fit API request returning empty points for steps (Node.js)

Im following a video tutorial on how to use the google fit API for checking steps with node.js and managed to make everything work.
My problem is, when getting the value of steps, the pointarray is returning empty.
Examples
Here are some examples on what is happening vs. what should happen.
my Request
const result = await axios({
method: 'POST',
headers: {
authorization: "Bearer " + tokens.tokens.access_token
},
"Content-Type": "application/json",
url: `https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate`,
data: {
aggregateBy: [{
dsataTypeName: "com.google.step_count.delta",
dataSourceId: 'derived:com.google.step_count.delta:com.google.android.gms:estimated_steps'
}],
bucketByTime: { durationMillis: 1000*60*60*24 },
startTimeMillis: 1642129199000, //get from https://currentmillis.com
endTimeMillis: 1642301999000
}
})
This result will return to me a data.bucket with the data im looking for. However, those buckets are looking like this:
When they should be looking like this (from the tutorial):
As you can see, my point array is empty rather then having some value.
I checked my Google fit App and I have data for this timespan.
Also noting that, even if I had taken 0 steps those days, the point array would not be empty, but would have value of 0.
Here is also the structure of the point array (also from tutorial):
Is there something I'm missing thats dumb?? pls help I never coded for Google APIs before

search api in loopback nodejs

I have a need to implement this api in loopback nodejs
https://myapi.com/part_numbers?part_number=1245,6787,89490,940044...
Any ideas on how to go about it ?
The path after part_number should accept atleast 100 partnumbers and then return me the result.
All the documentation that i have looked at in loopback talks abut only sending a get request to something like https://myapi.com/part_numbers?part_number=1245
but not about sending for multiple comma separated values
Any ideas on how do i build this endpoint using loopback and nodejs I am using mysql as the backend datastore.
Disclaimer: I am a maintainer of LoopBack and co-author of the pull request adding support for character-delimited arrays in input arguments.
LoopBack provides a feature flag to enable comma-delimited array values in input arguments, this flag was added by https://github.com/strongloop/strong-remoting/pull/142. (Unfortunately it's not documented yet.)
How to use it:
1) Configure allowed delimiters in your server/config.json:
{
"restApiRoot": "/api",
// ...
"rest": {
"handleErrors": false,
// ADD THE FOLLOWING LINE
"arrayItemDelimiters": [","],
// original content - keep it around:
"normalizeHttpPath": false,
"xml": false
},
// ...
}
2) Define a custom remote method (see docs) accepting an argument of type "array of numbers". For example, assuming you have a model called PartNumbers already defined:
PartNumbers.get = function(numbers) {
// replace this code with your implementation
// here, we simply return back the parsed array
return Promise.resolve(numbers);
};
PartNumbers.remoteMethod('get', {
accepts: {
arg: 'part_numbers',
type: ['number'],
required: true,
},
// modify "returns" to match your actual response format
returns: {
arg: 'data',
type: 'object',
root: true,
},
http: {verb: 'GET', path: '/'},
});
3) Start you application, open API Explorer at http://localhost:3000/explorer and give your new method a ride!

Podio Filter item method response missing files details

In nodejs I am trying to filter podio data by using FilterItems its working fine but its not giving files attributes. I can get the files count but I need uploaded files details. Here is my sample code
var Podio = require('podio-js').api;
var podio = new Podio({
authType: 'server',
clientId: 'XXXXX',
clientSecret:'*****************'
});
podio.authenticateWithApp('XXXXX', 'YYYYYYYYYYYYYY', function(err) {
podio.request('POST', '/item/app/XXXXX/filter', {
"filters": { "email":'sample#gmail.com'}
}).then(function(responseData) {
console.log(responseData);
}).catch(function(e) {
console.log(e);
});
});
To solve this problem am doing one more call Get Item by using Item-id (Which I have received from filter call).
Here my question is why filter method is not giving files details whether its bug in podio filter call or is there any specific reason. Please suggest better way too.
Note: In my scenario I should use only filter functionality;
You can get additional fields (including files) by bundling responses using fields parameter. It's described here: https://developers.podio.com/index/api
Sample:
// Include files when getting filtered items
/item/app/{app_id}/filter/?fields=items.fields(files)

Inserting a user into a person field in sharepoint using the rest api

I'm trying to update a list item in a remote sharepoint site using the rest api from a workflow. I'm having issues understanding how to populate a person field. I've looked online and read that you should use the id of the user and not the login, however what if I do not know the users id? Where can I get this from?
I've been reading the following link but it doesn't explain where the id comes from
how to add user to sharepoint list item user field using REST api in sp2013?
You will be able to view all UserProfile Properties by using this REST call:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=#v)?#v='domain\user'
To get a specific Property (in this case UserProfileGUID) use:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=#v,propertyName='UserProfile_GUID')?#v='domain\user'
If you are using CSOM this might help you:
The proper way to write a SharePoint User to a User Field in a SharePoint list
I have done this successfully in the past using both CSOM (js) and SSOM (powershell).
I know its a a bit late but for anyone looking for the answer on how to get the user id use the below function
function getUserId(userName) {
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/siteusers?$select=Id&$filter=Title eq '" + userName + "'",
type: 'GET',
headers: {
"Accept": "application/json;odata=verbose"
},
success: function (data) {
return data.d.results[0].Id;
},
error: function (error) {
console.log(error);
}
});
}

Loopback - Custom Api not getting displayed in explorer

I have created a remote method in my model named "FreeEmailProviders" that contains fields "id" and "domainname".
The code for creating the remote method is as follows:
FreeEmailProviders.checkEmailDomain = function(email, cb) {
cb(null, email);
};
FreeEmailProviders.remoteMethod(
'checkEmailDomain',
{
http: {path: '/checkEmailDomain', verb: 'get'},
accepts: {arg: 'email', type: 'string'},
returns: {arg: 'isEmailFreeProvider', type: 'string'}
}
);
Now when i am running the application, this method is not displaying in the list of APIs for this method.
When i am running the api directly in the browser, that is when i am calling the url:
http://localhost:4000/api/FreeEmailProviders/checkEmailDomain?email=test#gmail.com
I am getting the below error:
{"error":{"name":"Error","status":404,"message":"Unknown \"FreeEmailProviders\" id \"checkEmailDomain\".","statusCode":404,"code":"MODEL_NOT_FOUND","stack":"Error: Unknown \"FreeEmailProviders\" id \"checkEmailDomain\".\n at Function.convertNullToNotFoundError }}
Can anyone help me with this ?
I ran into the same problem. After 3 hours I figured I had a typo in the *.js file.
If you used the model generator you should not run into this issue. If you created the files yourself make sure the .json and .js file in common/models have exact the same name except for the extension.
It would be nice if Loopback throws an error in such cases.

Resources