rcohen
Posts: 1
Joined: Wed Nov 03, 2021 3:49 pm

Data Table Appearing but Not Graph Data

I have a chart generated by the following code:

Code: Select all

Highcharts.getJSON(`${http}://${url}/graphs/sites/${site_id}/minute_heating_status`, function (data) {
        Highcharts.stockChart(‘heating-graph-minute’, {
          rangeSelector: {
            selected: 1,
            buttons: [{
                type: ‘hour’,
                count: 1,
                text: ‘1h’,
                dataGrouping: {
                  forced: true,
                  units: [
                    [‘minute’, [1]]
                  ]
                }
              },
              {
                type: ‘day’,
                count: 1,
                text: ‘1d’,
                dataGrouping: {
                  forced: true,
                  units: [
                    [‘minute’, [1]]
                  ]
                }
              }
            ]
          },
          series: series_data(data),
          yAxis: {
            opposite: false,
            title: {
              text: “Temperature (°F)”
            }
          },
          xAxis: {
            title: {
              text: “Timestamp”
            }
          },
          navigator: {
            maskFill: “rgba(0, 102, 0, 0.1)”
          },
          legend: {
            enabled: true
          },
          credits: {
            enabled: false
          },
          chart: {
            alignTicks: false
          },
          tooltip: {
            pointFormat: “{point.y:.2f}”
          },
          title: {
            text: “Real Time Heating Data”,
            style: {
              color: ‘#000000’,
              fontWeight: ‘bold’,
              fontSize: ‘24px’
            }
          },
          plotOptions: {
            series: {
              showInNavigator: true
            }
          }
        });
      });
11:54
Highcharts.setOptions({
        global: {
          useUTC: false
        },
        lang: {
          thousandsSep: ‘,’
        }
      });
      function series_data(data) {
        var series = [];
        for (var i = 0; i < data.length; i++) {
          series.push({
            name: data[i].name,
            color: data[i].color,
            data: data[i].data
          });
        }
        return series;
      };
      var site_id = document.getElementById(‘site_id’).value;
      var url;
      var http;
     
This is what the chart looks like:
Screen Shot 2021-11-03 at 11.54.09 AM.png
Screen Shot 2021-11-03 at 11.54.09 AM.png (177.67 KiB) Viewed 365 times

It seems like the data is loading fine, but isn't appearing on the chart. Any ideas what could be the problem?
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Data Table Appearing but Not Graph Data

Hello rcohen,

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

I've created a chart based on your shared config, everything seems to be working fine though.
Demo: https://jsfiddle.net/BlackLabel/fzqywt1m/

I guess the problem is related to your data. Please make sure that your data format is correct with the one specified in our documentation e.g https://api.highcharts.com/highstock/series.line.data

If that doesn't help then please try to update the shared demo with your sample data and I'll try to figure it out.

Regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Stock”