areski / django-nvd3

Django wrapper for nvd3 - It's time for beautiful charts
Other
416 stars 124 forks source link

The chart can't show with error "Uncaught TypeError: a.dispatch.render_start is not a function" #104

Closed chenyu7721 closed 1 year ago

chenyu7721 commented 1 year ago

Who can help me check the issue? Thanks at advance The web can't show the chart with error "Uncaught TypeError: a.dispatch.render_start is not a function"

  1. versions are as following in my env: d3#3.5.17 nvd3#1.8.6 django-nvd3 0.9.7 python-nvd3 0.15.0 Django 4.1.5

  2. html code: {% load nvd3_tags %}

    {% include_chart_jscss %} {% load_chart charttype chartdata chartcontainer %}

    Fruits vs Calories

    {% include_container chartcontainer 400 600 %}
  3. view.py: def payroll_table(request): xdata = ["Apple", "Apricot", "Avocado", "Banana", "Boysenberries", "Blueberries", "Dates", "Grapefruit", "Kiwi", "Lemon"] ydata = [52, 48, 160, 94, 75, 71, 490, 82, 46, 17] chartdata = {'x': xdata, 'y': ydata} charttype = "pieChart" chartcontainer = 'piechart_container' data = { 'charttype': charttype, 'chartdata': chartdata, 'chartcontainer': chartcontainer, 'extra': { 'x_is_date': False, 'x_axis_format': '', 'tag_script_js': True, 'jquery_on_ready': False, } } return render(request, 'home/salary.html', data)

chenyu7721 commented 1 year ago
  1. STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static1') is nessary, which is diffrent from STATICFILES_DIRS.
  2. python manage.py collectstatic
  3. Change chart.tooltipContent to chart.tooltip.contentGenerator in the files pythonx.x/site-packages/nvd3/templates/content.html and pythonx.x/site-packages/nvd3/templates/piechart.html