HighCharts Editor Plugin Example not working - highcharts

So I have the jquery-simple-rest plugin for Highcharts, (same used in the example documentation). I've linked the js file, and am not getting any errors in my browser. The documentation mentions also needing to the highed.use.
//The installer
highed.plugins.editor.install("jquery-simple-rest",{
//Contains information about the plugin - optional
meta:{
version:"1.0.0",
author:"Highsoft",
homepage:"https://github.com/highcharts/highcharts-editor/plugins/jquery-simple-rest.js"
},
//Add additional external dependencies here
dependencies:[
"https://code.jquery.com/jquery-3.1.0.min.js"
],
//This is the prototype options which the plugin accepts
options:{
url:{
required:!0,
type:"string"}
},
//Called when the chart changes
chartchange:function(e,t)
{jQuery.ajax({
url:t.url,
data:e.json,
dataType:"json",
type:"post"
,success:function(){
highed.snackBar("CHART SAVED")
},
error:function(e,t){
highed.snackBar("unable to save chart: "+t)
}
})
}
});
highed.plugins.editor.use('jquery-simple-rest', {options:{
url:{
required:!0,
type:"string"}
},
}
);
I can not get this plugin to appear in my the editor, and have no idea what it is I'm doing wrong.
link to example: https://github.com/highcharts/highcharts-editor/wiki/Plugins

Related

Unable to move file with MS Graph API for Onedrive. 200 Response containing old Parent ID

So I'm quite a fan of the Graph API to manage Onedrive from my server.
Now I'm trying to use the Graph API to move a file from one directory to another one following the documentation here.
Now in order to do so, I send (PATCH) the following to https://graph.microsoft.com/v1.0/me/drive/items/01A2ASUEXPG7EKMCTPDJDY7L5YMVTNWHMO:
{'parentReference': {'id': '01A2ASUEVXTMODEW6HIJC3MSXT5JJ4JLRK'}}
And I receive:
{
"#odata.context":"https://graph.microsoft.com/v1.0/$metadata#users('b9dc908f-6c6f-463b-a568-9361fabdc995')/drive/items/$entity",
"#microsoft.graph.downloadUrl":"xxxx",
"createdDateTime":"2022-04-20T08:46:12Z",
"eTag":"\"{A6C837EF-6F0A-471A-8FAF-B86566DB1D8E},1\"",
"id":"01A2ASUEXPG7EKMCTPDJDY7L5YMVTNWHMO",
"lastModifiedDateTime":"2022-04-20T08:46:12Z",
"name":"IMG.png",
"webUrl":"https://xxxx-my.sharepoint.com/personal/xxxx-uitzendbureau_nl/Documents/Loonstroken%20(alleen%20voor%20toevoegen)/xxxx/IMG.png",
"cTag":"\"c:{A6C837EF-6F0A-471A-8FAF-B86566DB1D8E},1\"",
"size":382692,
"createdBy":{
"user":{
"email":"Online#xxxx.nl",
"id":"b9dc908f-6c6f-463b-a568-9361fabdc995",
"displayName":"Online beheer"
}
},
"lastModifiedBy":{
"user":{
"email":"Online#xxxxx.nl",
"id":"b9dc908f-6c6f-463b-a568-9361fabdc995",
"displayName":"Online beheer"
}
},
"parentReference":{
"driveType":"business",
"driveId":"b!u2WpOb6qnkS_6foMbPUq90TwxghBinBMhj9DwokQnQefs7rIOSQYS5kmJNV5uSJ7",
"id":"01A2ASUEWGZQX5GCGE2RFL6J3WBIW2LTUC",
"path":"/drive/root:/Loonstroken (alleen voor toevoegen)/xxxxxx"
},
"file":{
"mimeType":"image/png",
"hashes":{
"quickXorHash":"Yk0eRqT2ThqJHamo0AMLstI0CBI="
}
},
"fileSystemInfo":{
"createdDateTime":"2022-04-20T08:46:12Z",
"lastModifiedDateTime":"2022-04-20T08:46:12Z"
},
"image":{
},
"shared":{
"scope":"users"
}
}
As you can see:
'parentReference': {'driveType': 'business', 'driveId': 'xxx', 'id': '01A2ASUEWGZQX5GCGE2RFL6J3WBIW2LTUC', 'path': '/drive/root:/Loonstroken (alleen voor toevoegen)/xxxxxx'}
The parentReference ID has not changed to the one provided in the request, but still a 200 is returned. Also the file obviously was not moved.
Any idea what might be the issue here?
Answering my own question.
Seems this was an issue on Microsoft's end. I now get a correct parentReference in the response.

Highcharts credits link not working when exporting as PDF

When I set the credits.href option for a Highcharts chart, everything works well in the browser. The credits text is a clickable link.
However, if the chart is exported as a PDF, the credits text is not a link.
Here is my code:
let exportOptions = {
filename: filename,
fallbackToExportServer: false,
type: 'application/pdf'
};
let chartOptions= {
credits: {
enabled: true,
href: "http://example.com",
text: "TEMA-Q GmbH"
}
}
chart.exportChartLocal(exportOptions, chartOptions);
Am I doing something wrong or are credit urls simply not exported to PDF?
I am afraid that this functionality has not been implemented yet. I reported this idea on the Highcharts Github issue channel where you can follow and vote up this thread.
Link: https://github.com/highcharts/highcharts/issues/13594

Google Docs API : How to update alignment of the table?

I have a Table in the google docs and want to change its alignment to -0.71 but i do not see any Python API to change table properties. This can be done easily using following UI on google UI (as shown below):
I also tries looking at following requests but could not find it:
updateTableColumnProperties
updateTableCellStyle
For debugging, i created a doc with mentioned alignment and tried dumping JSON of it. But i do not see alignment keyword in the JSON.
Thanks #jescanellas for reply.
I found a hack, this may not be the best solution but works.
1) Update paragraph style and set the indentation, alignment as required. Here the start_idx is the index where table needs to be created.
request = [{
'updateParagraphStyle': {
'paragraphStyle': {
'namedStyleType': 'HEADING_5',
'direction': 'LEFT_TO_RIGHT',
'alignment': 'START',
'indentFirstLine': {
'magnitude': -51.839999999999996,
'unit': 'PT'
},
'indentStart': {
'magnitude': -51.839999999999996,
'unit': 'PT'
},
},
'fields': '*',
'range': {
'startIndex': start_idx,
'endIndex': end_idx
}
}
}]
2) Create the table, it will get created at new indented place.
request = [{
'insertTable': {
'rows': 1,
'columns': 1,
'location': {
'segmentId':'',
'index': start_idx
}
},
}]
It's not currently possible to do so. You can create a Feature Request for the Docs API, and you can also subscribe to this one for Apps Script by clicking on the star next to the Issue number to give more priority to the request and to receive updates.
In case of the second request being implemented, you could call the script from the command line using Clasp.

how do I include files that sw-precache misses

Context
I'm using parcel-plugin-sw-precache which wraps around sw-precache to make it work with Parcel.js. Everything was working as expected, and I have been testing my offline app.
Problem
I added react-pdf.js into my project, one of the dependencies for this library doesn't get added into the service worker when it is generated by the sw-precache. I know this because the file "pdf.worker.entry.7ce4fb6a.js" gives a 304 error when I switch to offline mode.
What I have tried
I'm trying to add the file manually to the package.json parcel-plugin-sw-precache config using this code:
"sw-precache": {
"maximumFileSizeToCacheInBytes": 10485760,
"staticFileGlobs": [
"/pdf.worker.entry.7ce4fb6a.js"
]
},
I'm not sure if the file path should be relative to package.json or relative the generated service worker. In anycase, the manually specified file doesn't get added to generate services worker as I would expect. As seen below.
self.__precacheManifest = [{
"url": "index.html",
"revision": "ac5ace7a43a0fef7ae65fd3119987d1f"
}, {
"url": "castly.e31bb0bc.css",
"revision": "657409f7159cb857b9409c44a15e653f"
}, {
"url": "castly.e31bb0bc.js",
"revision": "018d4664d809ec19d167421b359823ad"
}, {
"url": "/",
"revision": "af5513bb330deae3098ab289d69a40c7"
}]
The question
If the sw-precache or parcel-plugin-sw-precache seem to be missing some files, how can I make sure they get added to the generated service worker?
In my exploration for an answer. I gave up on using parcel-plugin-sw-precache and instead I switched to using workbox. If you are interested in creating an offline app with Parcel.js. Then I recommend Workbox as it is the next generation of sw-precache.
There is how I got it working:
Learning
Learn what Workbox is and what is does with this code lab.
Implimenting
1) Install the Workbox CLI globally.
2) create a placeholding service worker in the root directory. e.g. sw_shell.js
- The shell is a holding file. The Workbox wizard will pick it up and generate a
new sw.js file automatically.
3) Add to the sw_config.js the following code:
importScripts("https://storage.googleapis.com/workbox-cdn/releases/3.6.3/workbox-sw.js");
if (workbox) {
workbox.skipWaiting();
workbox.clientsClaim();
workbox.precaching.suppressWarnings();
// The next line came from the code lab
workbox.precaching.precacheAndRoute([]);
workbox.routing.registerNavigationRoute("/index.html");
} else {
console.log(`Boo! Workbox didn't load 😬`);
}
4) Run this code from a command line opened in your project's root directory.
workbox wizard --injectManifest
5) Follow the steps in the wizard. For dev purposes point the "root web app" to your parcel dist folder. Workbox does it's magic and picks up those files to be hashed into a new sw.js file.
6) The wizard will ask for your existing sw.js file. In my case I use the sw_shell.js.
a:Workbox picks up the sw_shell.js.
c:Generates as new sw.js file in a location specfied when running the wizard, and injects the files to run offline.
In my case I let the new sw.js generate in my root folder because Parcel picks it up automatically as per the script in my index.js.
'use strict';
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('sw.js').then(function(reg) {
console.log('Worker registration started')
reg.onupdatefound = function() {
console.log('update found')
var installingWorker = reg.installing;
installingWorker.onstatechange = function() {
console.log('installing worker')
switch (installingWorker.state) {
case 'installed':
if (navigator.serviceWorker.controller) {
console.log('New or updated content is available.');
} else {
console.log('Content is now available offline!');
}
break;
case 'redundant':
console.error('The installing service worker became redundant.');
break;
}
};
};
}).catch(function(e) {
console.error('Error during service worker registration:', e);
});
});
}
7) Add workbox injectManifest to your package.json to make sure Workbox picks up any changes to your files:
"scripts": {
"start": "parcel index.html workbox injectManifest"
}
Let me know if you want to know more about this. There is a video here that helped me a little bit also.

JqGrid : File Upload not working

I am trying to upload file with jqgrid, but the is some mistake in my code.
I am using onInitializeForm method.
I am using Jquery Ajax File Uploader
Can anyone do help to me?
You can see Error in screenshot
This is my code.
jQuery("#formGrid").jqGrid(
{
url:'application/ajax/common_form_detail.php?form_id='+form_id,
editurl:'application/ajax/common_form_edit.php?form_id='+form_id,
datatype: "json",
colNames:[<?php echo $strfield; ?>],
colModel:[<?php echo $strFieldModel; ?>],
rowNum:20,
rowList:[20,50,100],
pager: '#formControl',
sortname: 'id',
viewrecords: true,
sortorder: "asc",
autowidth: true,
height: 400,
width: 900
});
jQuery("#formGrid").jqGrid('navGrid','#formControl',
{ edit:true,add:true,del:true,search:false},
{width:780,recreateForm:true},
{width:780,recreateForm:true
,onInitializeForm : function(formid){
$(formid).attr('method','POST');
$(formid).attr('action','');
$(formid).attr('enctype','multipart/form-data');
}, afterSubmit : function(response, postdata){
$.ajaxFileUpload({
url: 'application/ajax/common_file_upload.php',
secureuri:false,
fileElementId:'STUDENT_AVATAR',
dataType: 'json',
success: function (data, status) {
alert("Upload Complete.");
}
});
}
});
});
One can see that you have error in jQuery.handleError function which is depreciated from jQuery 1.5. jQuery Ajax File Uploader V2.1 provided from the download page included jQuery 1.2.1.
One have to fix the code of Ajax File Uploader to solve the problem. See the answer and the answer for example or this one. You can consider to use another Plugin for file upload like jQuery Form Plugin (and here), see here.

Resources