Attempting to pilot a server-side render of a gantt chart using highcharts-export-server, but unable to get the series data to render at all.
As per the docs, I've tried running the export via commandline and as a node module, but I always get an empty graph with the title, subtitle and series name displaying, but none of the actual data.
Failed Gantt Render
All the basic line graph example configurations work and I'm able to render the chart using the Highcharts.ganttChart method via the browser, so I believe it's specific to the Gantt chart configuration for the export server, or related to the millisecond date conversion (as you can see in the screenshot, the X Axis is not rendering as dates, but rather plain numbers). As per suggestions on other threads, I ran build.js in the node_modules/highcharts-export-server, globally for the commandline attempt and project-locally for the node module attempt, making sure to enable the both the gantt and moment libraries, but that didn't help either.
Including my options json below. I haven't been able to find a gantt config example specifically for the export server, so this is my best attempt to interpolate what they'd be:
{
"title": {
"text": "Gantt PoC"
},
"subtitle": {
"text": "Timeline"
},
"series": [
{
"name": "Gantt Demo",
"type": "gantt",
"data": [
{
"name": "Demo Task 1",
"id": "demo_task_1",
"start": 1564113600000,
"end": 1564718400000
},
{
"name": "Demo Task 2",
"id": "demo_task_2",
"start": 1564113600000,
"end": 1564718400000
}
]
}
],
"xAxis": {
"min": 1563681600000,
"max": 1571803200000
}
}
Please let me know if there's anything obviously wrong with my config, if I missed any crucial steps to prep the environment, or any ideas you may have for me to troubleshoot. Thanks!
i also tried to generate image using ganttchart, just i tried constructor which you suggested working perfectly, Thanks.
highcharts-export-server --infile gantt.json --outfile gantt.png --type png --constr ganttChart
actually i tried with HTTP Server as well, working perfectly. Thanks #pawel_d
const fs = require("fs");
const chartExporter = require('highcharts-export-server');
chartExporter.initPool();
const chartDetails = {
type: "png",
constr : 'ganttChart',
options: {
series: [{
data: [{
start: 1,
end: 10
}]
}]
}
};
chartExporter.export(chartDetails, (err, res) => {
// Get the image data (base64)
let imageb64 = res.data;
// Filename of the output
let outputFile = "bar.png";
// Save the image to file
fs.writeFileSync(outputFile, imageb64, "base64", function(err) {
if (err) console.log(err);
});
console.log("Saved image!");
chartExporter.killPool();
});
Related
i have a functional PHP script to add plain text into Google Document, but I'm struggling to insert paragraphs with styles. What I want to achieve is
append heading paragraph with text
append paragraph with hyperlink
There is insertText request but it's not possible to style this text directly in request. And there is not insertParagraph, so everytime when i insert text i cant even make a new line. https://developers.google.com/docs/api/reference/rest/v1/documents/request
It's frustrating how difficult is to work with Google Docs API, it should be much easier to do such basic tasks, please help.
I believe your goal is as follows.
You want to put the texts with the paragraph style and the text style.
You want to achieve this using Google Docs API.
In this case, how about the following sample request body?
Flow:
In order to achieve your goal, when the batchUpdate method is used, as a sample flow, the following flow is used.
Insert Texts.
In this sample, the texts of Sample1\n and Sample2\n are inserted.
Set paragraph style.
In this case, "HEADING_1" and "NORMAL_TEXT" are reflected in the text of Sample1\n and Sample2\n, respectively.
Set text style.
In this case, a hyperlink of https://www.google.com is set to the text of Sample2\n.
When this flow is reflected in a request body, it becomes as follows. Of course, for example, you can change this flow like "1. Insert Sample1\n. 2. Set paragraph style. 3. Insert Sample2\n. 4. Set paragraph style. 5. Set text style.".
Sample request body:
{
"requests": [
{
"insertText": {
"text": "Sample1\n",
"location": {
"index": 1
}
}
},
{
"insertText": {
"text": "sample2\n",
"location": {
"index": 9
}
}
},
{
"updateParagraphStyle": {
"range": {
"startIndex": 1,
"endIndex": 8
},
"paragraphStyle": {
"namedStyleType": "HEADING_1"
},
"fields": "namedStyleType"
}
},
{
"updateParagraphStyle": {
"range": {
"startIndex": 9,
"endIndex": 17
},
"paragraphStyle": {
"namedStyleType": "NORMAL_TEXT"
},
"fields": "namedStyleType"
}
},
{
"updateTextStyle": {
"range": {
"startIndex": 9,
"endIndex": 16
},
"textStyle": {
"link": {
"url": "https://www.google.com"
}
},
"fields": "link"
}
}
]
}
Testing:
When you test this request body with "Try this API" of batchUpdate method of Docs API, you can do it at this link. In this link, the request body has already been set. Please prepare a sample Google Document and set your Google Document ID.
Result:
When this request body is used for a Google Document, the following result is obtained.
References:
InsertTextRequest
UpdateParagraphStyleRequest
UpdateTextStyleRequest
I am able to use the below JSON through POSTMAN to run my Databricks notebook.
I want to be able to give a name to the cluster that is created through the "new_cluster" options.
Is there any such option available?
{
"tasks": [
{
"task_key": "Job_Run_Api",
"description": "To see how the run and trigger api works",
"new_cluster": {
"spark_version": "9.0.x-scala2.12",
"node_type_id": "Standard_E8as_v4",
"num_workers": "1",
"custom_tags": {
"Workload": "Job Run Api"
}
},
"libraries": [
{
"maven": {
"coordinates": "net.sourceforge.jtds:jtds:1.3.1"
}
}
],
"notebook_task": {
"notebook_path": "/Shared/POC/Job_Run_Api_POC",
"base_parameters": {
"name": "Junaid Khan"
}
},
"timeout_seconds": 2100,
"max_retries": 0
}
],
"job_clusters": null,
"run_name": "RUN_API_TEST",
"timeout_seconds": 2100
}
When the above API call is done, the cluster created has a name like "job-5975-run-2" and that is not super explanatory.
I have tried to use the tag "cluster_name" inside the "new_cluster" tag but I got an error that I can't do that, like this:
{
"error_code": "INVALID_PARAMETER_VALUE",
"message": "Cluster name should not be provided for jobs."
}
Appreciate any help here
Cluster name for jobs are automatically generated and can't be changed. If you want somehow track specific jobs, use tags.
P.S. If you want to have more "advanced" tracking capability, look onto Overwatch project.
I have a React-Native app that if I use the component and post an image to the timeline it is a full screen image. However... I am wanting to post an image server side using Python and I am unable to get the code right for posting an image that is full screen.
I have found the examples for posting images to be quite limited, and I have tried a few different combinations which I have pasted below.
user_feed = client.feed('timeline', user_id)
user_feed.add_activity({'actor': client.users.create_reference(user_id),
"verb": "post",
"object": 'my message to see if this thing actually works',
"attachments": {
"og": {
"title": "Crozzon di Brenta photo by Lorenzo Spoleti",
"description": "Download this photo in Italy by Lorenzo Spoleti",
"url": "https://unsplash.com/photos/yxKHOTkAins",
"images": [
{
"image": public_image_url
}
]
}
}})
The code above posts the image as a thumbnail with a description. If I remove the title and description, the image still posts as a small thumbnail - is there a way to get rid of the box and make it look like image 2 (full screen)? Image 1
image 2
As per https://getstream.github.io/react-native-activity-feed/#!/UI%20Components
const activity = {
actor: {
data: {
name: 'Nora Ferguson',
profileImage: 'https://randomuser.me/api/portraits/women/72.jpg',
},
},
verb: 'post',
object: 'Just came back from this hike! #Hiking #Madeira',
image:
'https://handluggageonly.co.uk/wp-content/uploads/2017/08/IMG_0777.jpg',
time: new Date(),
};
I want to format a JSON object in my Nodejs server. Delete some fields, rename some fields, and move some fields.
I have many different schemas need to apply to many different JSON, so I hope has a lib that can parse a configuration file and to it.
Maybe a configuration file like this:
DELETE request.logid
DELETE request.data.*.time
MOVE request.data.images data.images
And a JSON before applies an above schema:
{
"request": {
"data": {
"book": {
"name": "Hello World",
"time": 1546269044490
},
"images": [
"a-book.jpg"
]
},
"logid": "a514-afe1f0a2ac02_DCSix"
}
}
After applied:
{
"request": {
"data": {
"book": {
"name": "Hello World"
}
}
},
"data": {
"images": [
"a-book.jpg"
]
}
}
Where is the lib it is?
I know that write a function can do the same thing directly, but the problem is I have too many different schemas and too many different JSON, so I wanna manage them by configuration file rather than a js function.
Yes you could do something like this...
// Note: psuedocode
// Read the configuration file;
const commands = (await readFile('config')).split('\r\n').split(' ');
// your original JSON;
const obj = {...};
// Modify the JSON given the commands
commands.forEach( row=>{
if(row[0]==="DELETE"){
delete obj[row[1]];
}else if(row[0]==="MOVE"){
// use lodash to make your life easier.
_.set(obj,`${row[2]}`,_.get(obj,`${row[1]}`));
delete obj[row[1]];
}else if(...){
...
}
})
I am attempting to use the module Search Autocomplete 7.x-4.0-alpha2.
I have added a form in the "search_autocomplete" configuration section.
It is enabled.
I created a view that returns taxonomy in json format.
Here is an example of the json output from the json view
[{
"value": "aquaculture",
"fields": {
"name_i18n": "aquaculture"
},
"group": {
"group_id": "aquaculture",
"group_name": "aquaculture"
}
}, {
"value": "climate change",
"fields": {
"name_i18n": "climate change"
},
"group": {
"group_id": "climatechange",
"group_name": "climate change"
}
}, {
"value": "coastal development",
"fields": {
"name_i18n": "coastal development"
},
"group": {
"group_id": "coastaldevelopment",
"group_name": "coastal development"
}
}, {
"value": "deforestation",
"fields": {
"name_i18n": "deforestation"
},
"group": {
"group_id": "deforestation",
"group_name": "deforestation"
}
}, {
"value": "extinction",
"fields": {
"name_i18n": "extinction"
},
"group": {
"group_id": "extinction",
"group_name": "extinction"
}
}]
I set the Suggestion Source to be the view. I used the autocomplete feature of it so I know that my "search autocomplete" suggestion source is configured right. The id selector of a form in a different view (not the json taxonomy one) is used. The permissions for the module are correct.
Now, when I load my view that has the search api form I see a little blue circle icon that is circling to the right of the search api form field. It is circling the whole time and no suggestions are ever populated in the search text box.
I know I have the right form configured because if I set a different form id for the "searchautocomplete" configuration and reload the view page, the circling blue circle is missing.
Does anyone have any idea what might be wrong?
UPDATE: I was going to my modules page and saw this error (i wasn't changing anything on the modules page, just going there) and saw the error on the top of the modules page regarding the Search Autocomplete module
Update: I changed the Search Autocomplete configuration section to not point to my json view but point to an outside url, http://google.com. Of course this is not a valid json endpoint, but I wanted to see if I could see it at least attempt to get it's json data from google.com. Watching through firebug has shown that it doesn't even attempt to go to google.com for it's json data. I think something similar is happening with my json views (it's just not even going there for the data).
That was probably due to a bug in the alpha-version? When you configure the JSON Endpoint by using the Views UI, you should see a list of items in the "preview"-section underneath. The items that are listed there should be the ones that appear as suggestions in the search.