question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Apexcharts It is a possibility that you may have not included 'data' property in series, Cannot read property 'labels' of undefined

See original GitHub issue

I get three errors

When the map is rendered for the first time i get:

apexcharts:6 It is a possibility that you may have not included 'data' property in series
apexcharts:6 It is a possibility that you may have not included 'data' property in series

Then each time the map is rendered I get: Uncaught (in promise) TypeError: Cannot read property 'labels' of undefined

My code:


var options = {
  theme: {
    mode: 'light', 
    palette: 'palette1', 
    monochrome: {
        enabled: false,
        color: '#31a7ec',
        shadeTo: 'light',
        shadeIntensity: 0.65
    }
},
  chart: {
    height: 450,
    type: 'bar',
  },
   plotOptions: {
    bar: {
      horizontal: true,
    }
  },
  dataLabels: {
    enabled: true
  },
  series: [{
    name: "Consumption"
  }],
  title: {
    text: 'AMR Consumption',
  },
  noData: {
    text: 'No Data'
  }
}
var chart = new ApexCharts(
  document.getElementById("AMRbarchart"),
  options
)

// then i do ajax requests and add / destroy the chart

//ajax 

  $.getJSON('http://10....',  response => {
                chart.render()

                chart.updateOptions({
                    title: {
                        text: 'Consumption by year (' + unit + ') for ' + feature_name
                    },
                    chart: {
                        height: 380
                    }
                })

                chart.updateSeries([{
                    data: response.yearly
                }])
            })

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
junedchhipacommented, Feb 12, 2020

As the error suggests, you cannot have a series without a data property. Even if you don’t have anything in data, you should pass an empty array

series: [{
  name: "Consumption",
  data: []
}]
5reactions
nbtafelbergcommented, May 19, 2021

The problem is that the JSON calls are ASYNC so the system will hit ApexCharts.exec before the data. is loaded.

Read more comments on GitHub >

github_iconTop Results From Across the Web

It is a possibility that you may have not included 'data' property ...
I want to be able to CRUD the Gantt chart. But I can't even add the new data yet. I have also tried...
Read more >
Series [Working with Data] - ApexCharts.js
The series expects a single array for pie/donut and radialbar charts. The names of the series values are to be provided in labels...
Read more >
How to use ApexCharts.js with wpDataTables
ApexCharts.js is an open-source chart rendering engine. ... (on left) and Line chart with data labels and custom size of tick amount and...
Read more >
Visualization: Column Chart - Google Developers
While users can hover over the columns to see the data values, you might want to include them on the columns themselves: This...
Read more >
Uncaught (in promise) TypeError: Cannot read properties of ...
You likely have two errors. The first is that you are trying to send an email from a cacheable method (which you can't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found