mwicks23
Posts: 1
Joined: Thu Jul 29, 2021 9:19 am

No chart data found?

Dear HighCharts - I am having a problem using your system!

When I run HighCharts on the command line, my chart is generated perfectly; however, when I use HighCharts in server mode, I get an error:
"No chart data found. Please make sure you are using application/json or multipart/form-data headers, and that the chart data is in the options attribute if sending JSON."

This is the command that works correctly
"highcharts-export-server -infile ~/Desktop/highcharts_output_2.json -outfile ~/Desktop/output-file_2.png"

This command generates the above error:
"curl -H 'Expect:' -H 'Content-Type: application/json' -X POST -d @highcharts_output_2.json localhost:7801 -o output-file_2.png"

I'm running Highcharts in server mode like this:
"highcharts-export-server --enableServer 1 --host localhost --port 7801"

And this is the JSON I use in both situations:
{
"series": [
{
"name": "Ambiguous 1",
"data": [
{
"name": "SAMEA7495085-TCGTAGACACAGACTT",
"x": -7.84,
"y": -50.07
},
{
"name": "SAMEA7495085-TCTGGAACATGACATC",
"x": -5.35,
"y": -51.07
},
{
"name": "SAMEA7495085-TGACGGCTCTTTACGT",
"x": -8.69,
"y": -47.77
},
{
"name": "SAMEA7495085-TGCCCATAGCGAAGGG",
"x": -7.31,
"y": -49.11
},
{
"name": "SAMEA7495085-TGCGGGTTCGGCGCTA",
"x": -6.28,
"y": -49.53
},
{
"name": "SAMEA7495085-TGTGTTTCATGCTAGT",
"x": -15.95,
"y": -64.39
},
{
"name": "SAMEA7495085-TTAGGACTCAATCTCT",
"x": -8.81,
"y": -51.1
}
]
}
],
"xAxis": {
"visible": true
},
"yAxis": {
"visible": true
},
"title": {
"text": "E-MTAB-9684",
"align": "center",
"y": 20
},
"chart": {
"type": "scatter",
"height": 600,
"legend": {
"enabled": true
}
}
}

Obviously I'm doing something wrong - Can you tell me what please?

I tihnk I have to change the JSON so that the data is in the options field or something, but I can't find any documentation telling me how to do that?

Many thanks
Mike Wicks
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: No chart data found?

Hello mwicks23!

Welcome to our forum and thanks for contacting us with your question!

Regarding JSON file, it should be formatted like that:

Code: Select all

{
    "chart": {
        "type": "bar",
        "backgroundColor": "red"
    },
    "title": {
        "text": "Fruit Consumption"
    },
    "xAxis": {
        "categories": ["Apples", "Bananas", "Oranges"]
    },
    "yAxis": {
        "title": {
            "text": "Fruit eaten"
        }
    },
    "series": [{
        "name": "Jane",
        "data": [1, 0, 4]
    }, {
        "name": "John",
        "data": [5, 7, 3]
    }]
}

You should also determine whether you are referring to the correct file path in the command, e.g::

Code: Select all

npx ./bin/cli.js --batch "./examples/chart.json=./examples/chart.png;"

Some useful links:
https://www.highcharts.com/docs/export- ... the-server
https://www.highcharts.com/docs/export- ... serverside


Best regards!
Dominik Chudy
Highcharts Developer

Return to “Highcharts Usage”