c3js / c3

:bar_chart: A D3-based reusable chart library
http://c3js.org
MIT License
9.33k stars 1.39k forks source link

Cannot read properties of undefined (reading 'schemeCategory10') #2877

Closed aldrienht closed 1 year ago

aldrienht commented 1 year ago

ERROR: Uncaught TypeError: Cannot read properties of undefined (reading 'schemeCategory10')

SAMPLE CODE where error show up:

c3.generate({
      bindto: '#chart',
      data: {
        x:  'x',
        columns: [
          data['dates'],
          data['impressions'],
          data['clicks'],
          data['ctr'],
          data['positions']
        ]
      },
      axis: {
        x: {
          type: 'timeseries',
          tick: {
              format: '%Y-%m-%d'
          }
        }
      },
      tooltip: {
        format: {
          value: function (value, ratio, id) {
              .....
          }
        }
      }
    });
aldrienht commented 1 year ago

Solved - got it working by including d3.min.js For c3.js version 0.7.0 - compatible d3 version is 5.16.0 https://cdnjs.cloudflare.com/ajax/libs/d3/5.16.0/d3.min.js