Saigesp / vue-d3-charts

D3 charts for Vue
https://saigesp.github.io/vue-d3-charts/
GNU Lesser General Public License v2.1
97 stars 30 forks source link

this.cfg.values.forEach is not a function #6

Closed dahousecat closed 4 years ago

dahousecat commented 4 years ago

Just trying to create a line graph using sample data and configuration as supplied on this page but gettting the error:

this.cfg.values.forEach is not a function

When I inspect the code I can see that this.cfg.values is false

Saigesp commented 4 years ago

Have you provided any value for values?

chart_config: {
  values: ['hours', 'production'], // This option line
  date: {
    key: 'date',
    inputFormat: '%Y',
    outputFormat: '%Y',
  },
},

values must be an string array matching the field names that you want to draw:

chart_data: [
  {hours: 238, production: 134, date: 2000},
]
dahousecat commented 4 years ago

I see, got it - I just copied the sample code and expected it to work. I totally missed the little caveat saying:

To work with this data, configuration must be date: { key: "when", inputFormat: "%Y-%m-%d"}, values: ["iphone","android"].

Thanks for the swift reply!

Saigesp commented 4 years ago

Ok, great.

I'll add some error messages to help in these cases.